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.

Location:
code/branches/weapons/src/orxonox/objects/worldentities/pawns
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/weapons/src/orxonox/objects/worldentities/pawns/Pawn.cc

    r2912 r2914  
    123123        if (this->weaponSystem_)
    124124        {
    125             for (unsigned int firemode = 0; firemode < WeaponSystem::getMaxFireModes(); firemode++)
    126                 if (this->fire_ & WeaponSystem::getFireModeMask(firemode))
     125            for (unsigned int firemode = 0; firemode < WeaponSystem::MAX_FIRE_MODES; firemode++)
     126                if (this->fire_ & WeaponSystem::getFiremodeMask(firemode))
    127127                    this->weaponSystem_->fire(firemode);
    128128        }
     
    255255    void Pawn::fire(unsigned int firemode)
    256256    {
    257         this->firehack_ |= WeaponSystem::getFireModeMask(firemode);
     257        this->firehack_ |= WeaponSystem::getFiremodeMask(firemode);
    258258    }
    259259
     
    280280        this->attach(wSlot);
    281281        if (this->weaponSystem_)
    282             this->weaponSystem_->attachWeaponSlot(wSlot);
     282            this->weaponSystem_->addWeaponSlot(wSlot);
    283283    }
    284284
     
    291291    }
    292292
     293    void Pawn::addWeaponSet(WeaponSet * wSet)
     294    {
     295        if (this->weaponSystem_)
     296            this->weaponSystem_->addWeaponSet(wSet);
     297    }
     298
     299    WeaponSet * Pawn::getWeaponSet(unsigned int index) const
     300    {
     301        if (this->weaponSystem_)
     302            return this->weaponSystem_->getWeaponSet(index);
     303        else
     304            return 0;
     305    }
     306
    293307    void Pawn::addWeaponPack(WeaponPack * wPack)
    294308    {
    295309        if (this->weaponSystem_)
    296             this->weaponSystem_->attachWeaponPack(wPack, wPack->getFireMode());
    297     }
    298 
    299     WeaponPack * Pawn::getWeaponPack(unsigned int firemode) const
    300     {
    301         if (this->weaponSystem_)
    302             return this->weaponSystem_->getWeaponPack(firemode);
    303         else
    304             return 0;
    305     }
    306 
    307     void Pawn::addWeaponSet(WeaponSet * wSet)
    308     {
    309         if (this->weaponSystem_)
    310             this->weaponSystem_->attachWeaponSet(wSet);
    311     }
    312 
    313     WeaponSet * Pawn::getWeaponSet(unsigned int index) const
    314     {
    315         if (this->weaponSystem_)
    316             return this->weaponSystem_->getWeaponSet(index);
     310            this->weaponSystem_->addWeaponPack(wPack);
     311    }
     312
     313    WeaponPack * Pawn::getWeaponPack(unsigned int index) const
     314    {
     315        if (this->weaponSystem_)
     316            return this->weaponSystem_->getWeaponPack(index);
    317317        else
    318318            return 0;
  • code/branches/weapons/src/orxonox/objects/worldentities/pawns/Pawn.h

    r2912 r2914  
    8585            void addWeaponSlot(WeaponSlot * wSlot);
    8686            WeaponSlot * getWeaponSlot(unsigned int index) const;
    87             void addWeaponPack(WeaponPack * wPack);
    88             WeaponPack * getWeaponPack(unsigned int firemode) const;
    8987            void addWeaponSet(WeaponSet * wSet);
    9088            WeaponSet * getWeaponSet(unsigned int index) const;
     89            void addWeaponPack(WeaponPack * wPack);
     90            WeaponPack * getWeaponPack(unsigned int index) const;
    9191
    9292            inline const WorldEntity* getWorldEntity() const
Note: See TracChangeset for help on using the changeset viewer.