Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/orxonox/weaponsystem/Munition.h @ 5899

Last change on this file since 5899 was 5781, checked in by rgrieder, 15 years ago

Reverted trunk again. We might want to find a way to delete these revisions again (x3n's changes are still available as diff in the commit mails).

  • Property svn:eol-style set to native
File size: 3.4 KB
RevLine 
[2049]1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
[2918]22 *   Authors:
[2049]23 *      Martin Polak
[2918]24 *      Fabian 'x3n' Landau
[2049]25 *   Co-authors:
26 *      ...
27 *
28 */
29
30#ifndef _Munition_H__
31#define _Munition_H__
32
33#include "OrxonoxPrereqs.h"
[2918]34
35#include <map>
[2049]36#include "core/BaseObject.h"
[2918]37#include "tools/Timer.h"
[2049]38
39namespace orxonox
40{
41    class _OrxonoxExport Munition : public BaseObject
42    {
[2918]43        struct Magazine
44        {
45            public:
46                Magazine(Munition* munition, bool bUseReloadTime = true);
47
48                unsigned int munition_;
49                Timer<Magazine> loadTimer_;
50                bool bLoaded_;
51
52            private:
53                void loaded(Munition* munition);
54        };
55
[2049]56        public:
[2097]57            Munition(BaseObject* creator);
[2049]58            virtual ~Munition();
59
[2918]60            unsigned int getNumMunition(WeaponMode* user) const;
61            unsigned int getNumMunitionInCurrentMagazine(WeaponMode* user) const;
62            unsigned int getNumMagazines() const;
[2049]63
[2918]64            unsigned int getMaxMunition() const;
65            inline unsigned int getMaxMagazines() const
66                { return this->maxMagazines_; }
67            inline unsigned int getMaxMunitionPerMagazine() const
68                { return this->maxMunitionPerMagazine_; }
[2662]69
[2918]70            bool canTakeMunition(unsigned int amount, WeaponMode* user) const;
71            bool takeMunition(unsigned int amount, WeaponMode* user);
[2662]72
[2918]73            bool canReload() const;
74            bool needReload(WeaponMode* user) const;
75            bool reload(WeaponMode* user, bool bUseReloadTime = true);
76            inline float getReloadTime() const
77                { return this->reloadTime_; }
[2662]78
[2918]79            bool canAddMunition(unsigned int amount) const;
80            bool addMunition(unsigned int amount);
[2049]81
[2918]82            bool canAddMagazines(unsigned int amount) const;
83            bool addMagazines(unsigned int amount);
84
85            bool canRemoveMagazines(unsigned int amount) const;
86            bool removeMagazines(unsigned int amount);
87
88            bool dropMagazine(WeaponMode* user);
89
[2662]90        protected:
[2918]91            unsigned int maxMunitionPerMagazine_;
92            unsigned int maxMagazines_;
[2662]93            unsigned int magazines_;
[2918]94            std::map<WeaponMode*, Magazine*> currentMagazines_;
95
96            bool bUseSeparateMagazines_;
97            bool bStackMunition_;
98            bool bAllowMunitionRefilling_;
99            bool bAllowMultiMunitionRemovementUnderflow_;
100
101            float reloadTime_;
102
103        private:
104            Magazine* getMagazine(WeaponMode* user) const;
[2049]105    };
106}
107
[2106]108#endif /* _Munition_H__ */
Note: See TracBrowser for help on using the repository browser.