Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 10, 2009, 12:05:01 AM (16 years ago)
Author:
landauf
Message:

More changes in the WeaponSystem:

  • WeaponSets can now contain several WeaponPacks
  • WeaponPacks can now belong to several WeaponSets

(until now this seemingly was a 1:1 relationship… now it's n:m)

  • Started support for multiple weaponmodes
  • Added some code to the destructor of some classes… according to some legends, this helps destroying objects. (WeaponSets and WeaponPacks weren't deleted before…)

Not yet finished, but I have to synchronize desktop computer and notebook.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/weapons/src/orxonox/objects/weaponSystem/WeaponSystem.h

    r2912 r2914  
    4040namespace orxonox
    4141{
    42     const unsigned int MAX_FIRE_MODES = 8;
    43 
    4442    class _OrxonoxExport WeaponSystem : public BaseObject
    4543    {
     
    4846            virtual ~WeaponSystem();
    4947
    50             void attachWeaponSlot(WeaponSlot * wSlot);
     48            // adding and removing WeaponSlots
     49            void addWeaponSlot(WeaponSlot * wSlot);
     50            void removeWeaponSlot(WeaponSlot * wSlot);
    5151            WeaponSlot * getWeaponSlot(unsigned int index) const;
    5252
    53             void attachWeaponSet(WeaponSet * wSet);
     53            // adding and removing WeaponSets
     54            bool addWeaponSet(WeaponSet * wSet);
     55            bool addWeaponSet(WeaponSet * wSet, unsigned int firemode);
     56            void removeWeaponSet(WeaponSet * wSet);
    5457            WeaponSet * getWeaponSet(unsigned int index) const;
    5558
    56             void attachWeaponPack(WeaponPack * wPack, unsigned int wSetNumber);
     59            // adding and removing WeaponPacks
     60            bool canAddWeaponPack(WeaponPack * wPack);
     61            bool addWeaponPack(WeaponPack * wPack);
     62            void removeWeaponPack(WeaponPack * wPack);
    5763            WeaponPack * getWeaponPack(unsigned int index) const;
    5864
     65            // configure slots and firemodes
     66            bool swapWeaponSlots(WeaponSlot * wSlot1, WeaponSlot * wSlot2);
     67            void changeWeaponmode(WeaponPack * wPack, WeaponSet * wSet, unsigned int weaponmode);
     68
    5969            void fire(unsigned int firemode);
     70
    6071
    6172            void setNewMunition(const std::string& munitionType, Munition * munitionToAdd);
     
    7182                { return this->weaponSlots_.size(); }
    7283
    73             static inline unsigned int getMaxFireModes()
    74                 { return MAX_FIRE_MODES; }
    75             static inline unsigned int getFireModeMask(unsigned int firemode)
     84            static inline unsigned int getFiremodeMask(unsigned int firemode)
    7685                { return (0x1 << firemode); }
     86
     87            static const unsigned int MAX_FIRE_MODES = 8;
     88            static const unsigned int FIRE_MODE_UNASSIGNED = (unsigned int)-1;
     89
     90            static const unsigned int MAX_WEAPON_MODES = 8;
     91            static const unsigned int WEAPON_MODE_UNASSIGNED = (unsigned int)-1;
    7792
    7893        private:
Note: See TracChangeset for help on using the changeset viewer.