Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/weapons/src/orxonox/objects/weaponSystem/WeaponSystem.h @ 2912

Last change on this file since 2912 was 2912, checked in by landauf, 15 years ago

Several small adjustments in the weaponsystem (like additional const keyword, includes moved from .h to .cc where possible, …)

Firemode is now an unsigned int instead of an Enum. Instead of "fire" and "altFire" use "fire 0" and "fire 1"

File size: 2.8 KB
Line 
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 *
22 *   Author:
23 *      Martin Polak
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29
30#ifndef _WeaponSystem_H__
31#define _WeaponSystem_H__
32
33#include "OrxonoxPrereqs.h"
34
35#include <set>
36#include <map>
37
38#include "core/BaseObject.h"
39
40namespace orxonox
41{
42    const unsigned int MAX_FIRE_MODES = 8;
43
44    class _OrxonoxExport WeaponSystem : public BaseObject
45    {
46        public:
47            WeaponSystem(BaseObject* creator);
48            virtual ~WeaponSystem();
49
50            void attachWeaponSlot(WeaponSlot * wSlot);
51            WeaponSlot * getWeaponSlot(unsigned int index) const;
52
53            void attachWeaponSet(WeaponSet * wSet);
54            WeaponSet * getWeaponSet(unsigned int index) const;
55
56            void attachWeaponPack(WeaponPack * wPack, unsigned int wSetNumber);
57            WeaponPack * getWeaponPack(unsigned int index) const;
58
59            void fire(unsigned int firemode);
60
61            void setNewMunition(const std::string& munitionType, Munition * munitionToAdd);
62            void setNewSharedMunition(const std::string& munitionType, Munition * munitionToAdd);
63            Munition * getMunitionType(const std::string& munitionType) const;
64
65            inline void setPawn(Pawn * pawn)
66                { this->pawn_ = pawn; }
67            inline Pawn * getPawn() const
68                { return this->pawn_; }
69
70            inline int getWeaponSlotSize() const
71                { return this->weaponSlots_.size(); }
72
73            static inline unsigned int getMaxFireModes()
74                { return MAX_FIRE_MODES; }
75            static inline unsigned int getFireModeMask(unsigned int firemode)
76                { return (0x1 << firemode); }
77
78        private:
79            std::map<unsigned int, WeaponSet *> weaponSets_;
80            std::set<WeaponSlot *> weaponSlots_;
81            std::set<WeaponPack *> weaponPacks_;
82            std::map<std::string, Munition *> munitionSet_;
83            Pawn * pawn_;
84    };
85}
86
87#endif /* _WeaponSystem_H__ */
Note: See TracBrowser for help on using the repository browser.