Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 10, 2009, 12:05:01 AM (15 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/WeaponSet.h

    r2912 r2914  
    3333#include "OrxonoxPrereqs.h"
    3434
    35 #include <vector>
     35#include <map>
    3636
    3737#include "core/BaseObject.h"
     
    4242    {
    4343        public:
    44             WeaponSet(BaseObject* creator, int k = 0);
     44            WeaponSet(BaseObject* creator);
    4545            virtual ~WeaponSet();
    4646
    4747            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    4848
    49             void attachWeaponPack(WeaponPack *wPack);
     49//            void attachWeaponPack(WeaponPack *wPack);
     50
    5051            void fire();
    5152
    52             inline void setFireMode(const unsigned int firemode)
    53                 { this->firemode_ = firemode; }
    54             inline unsigned int getFireMode() const
    55                 { return this->firemode_; }
     53            void setWeaponmodeLink(WeaponPack* weaponpack, unsigned int weaponmode);
     54            void removeWeaponmodeLink(WeaponPack* weaponpack);
     55            unsigned int getWeaponmodeLink(WeaponPack* weaponpack);
     56
     57            inline void setDesiredFiremode(const unsigned int firemode)
     58                { this->desiredFiremode_ = firemode; }
     59            inline unsigned int getDesiredFiremode() const
     60                { return this->desiredFiremode_; }
    5661
    5762            inline void setWeaponSystem(WeaponSystem *weaponSystem)
     
    6267        private:
    6368            WeaponSystem *weaponSystem_;
    64             std::vector<WeaponSlot *> setWeaponSlots_;
    65             unsigned int firemode_;
    66             WeaponPack * attachedWeaponPack_;
     69            unsigned int desiredFiremode_;
     70            std::map<WeaponPack*, unsigned int> weaponpacks_;
    6771    };
    6872}
Note: See TracChangeset for help on using the changeset viewer.