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/WeaponPack.h

    r2912 r2914  
    3333#include "OrxonoxPrereqs.h"
    3434
    35 #include <vector>
     35#include <set>
    3636
    3737#include "core/BaseObject.h"
     
    4747            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    4848
    49             void fire();
    50 
    51             Weapon * getWeaponPointer(unsigned int n) const;
    52             int getSize() const;
    53 
    54             void setFireMode(unsigned int firemode);
    55             unsigned int getFireMode() const;
     49            void fire(unsigned int weaponmode);
    5650
    5751            void addWeapon(Weapon * weapon);
    58             const Weapon * getWeapon(unsigned int index) const;
     52            Weapon * getWeapon(unsigned int index) const;
     53
     54            inline size_t getNumWeapons() const
     55                { return this->weapons_.size(); }
     56
     57            unsigned int getDesiredWeaponmode(unsigned int firemode) { return 0; } // TODO
    5958
    6059            void attachNeededMunitionToAllWeapons();
    6160
    62             //functions with effect to all weapons of the weaponPack
    63             //functions needed for creating Pointer to the right objects (-->Pawn.cc)
    6461            inline void setWeaponSystem(WeaponSystem *weaponSystem)
    6562                { this->weaponSystem_ = weaponSystem; this->setWeaponSystemToAllWeapons(weaponSystem); }
     
    7067            void setWeaponSystemToAllWeapons(WeaponSystem * weaponSystem);
    7168
    72             std::vector<Weapon *> weapons_;
    73             WeaponSystem *weaponSystem_;
    74             unsigned int firemode_;
     69            std::set<Weapon *> weapons_;
     70            WeaponSystem * weaponSystem_;
    7571    };
    7672}
Note: See TracChangeset for help on using the changeset viewer.