Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6078


Ignore:
Timestamp:
Nov 17, 2009, 1:36:21 AM (14 years ago)
Author:
landauf
Message:

delete weaponpacks which were defined in xml but don't fit onto the weaponslots (in the future we could put them into the inventory).

+ some small changes

Location:
code/branches/particles2/src/orxonox
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/particles2/src/orxonox/controllers/Controller.h

    r5781 r6078  
    3737    class _OrxonoxExport Controller : public BaseObject
    3838    {
     39        // set friend classes to access setControllableEntity
     40        friend class PlayerInfo;
     41        friend class ControllableEntity;
     42       
    3943        public:
    4044            Controller(BaseObject* creator);
     
    4650                { return this->player_; }
    4751
     52            inline ControllableEntity* getControllableEntity() const
     53                { return this->controllableEntity_; }
     54            virtual void changedControllableEntity() {}
     55
     56        protected:
     57            // don't use this directly, use getPlayer()->startControl(entity) (unless you know exactly what you do)
    4858            inline void setControllableEntity(ControllableEntity* entity)
    4959            {
     
    5464                }
    5565            }
    56             inline ControllableEntity* getControllableEntity() const
    57                 { return this->controllableEntity_; }
    58             virtual void changedControllableEntity() {}
    5966
    60         protected:
    6167            PlayerInfo* player_;
    6268            ControllableEntity* controllableEntity_;
  • code/branches/particles2/src/orxonox/weaponsystem/WeaponPack.cc

    r6076 r6078  
    9696            return;
    9797
    98         assert( std::find(this->weapons_.begin(), this->weapons_.end(), weapon)!=this->weapons_.end() );
    99         this->weapons_.erase( std::find(this->weapons_.begin(), this->weapons_.end(), weapon) );
     98        std::vector<Weapon*>::iterator it = std::find(this->weapons_.begin(), this->weapons_.end(), weapon);
     99        assert(it != this->weapons_.end());
     100        this->weapons_.erase(it);
    100101        weapon->setWeaponPack(0);
    101102    }
  • code/branches/particles2/src/orxonox/weaponsystem/WeaponSystem.cc

    r6076 r6078  
    221221
    222222        // Remove the WeaponPack from the WeaponSystem
    223         assert( std::find(this->weaponPacks_.begin(),this->weaponPacks_.end(),wPack)!=this->weaponPacks_.end() );
    224         this->weaponPacks_.erase( std::find(this->weaponPacks_.begin(),this->weaponPacks_.end(),wPack) );
     223        std::vector<WeaponPack*>::iterator it = std::find(this->weaponPacks_.begin(),this->weaponPacks_.end(), wPack);
     224        assert(it !=this->weaponPacks_.end());
     225        this->weaponPacks_.erase(it);
    225226    }
    226227
  • code/branches/particles2/src/orxonox/worldentities/pawns/Pawn.cc

    r5929 r6078  
    110110        XMLPortObject(Pawn, WeaponSlot, "weaponslots", addWeaponSlot, getWeaponSlot, xmlelement, mode);
    111111        XMLPortObject(Pawn, WeaponSet, "weaponsets", addWeaponSet, getWeaponSet, xmlelement, mode);
    112         XMLPortObject(Pawn, WeaponPack, "weapons", addWeaponPack, getWeaponPack, xmlelement, mode);
     112        XMLPortObject(Pawn, WeaponPack, "weapons", addWeaponPackXML, getWeaponPack, xmlelement, mode);
    113113    }
    114114
     
    341341    }
    342342
     343    void Pawn::addWeaponPackXML(WeaponPack * wPack)
     344    {
     345        if (this->weaponSystem_)
     346            if (!this->weaponSystem_->addWeaponPack(wPack))
     347                wPack->destroy();
     348    }
     349
    343350    WeaponPack * Pawn::getWeaponPack(unsigned int index) const
    344351    {
  • code/branches/particles2/src/orxonox/worldentities/pawns/Pawn.h

    r5781 r6078  
    8989            WeaponSet * getWeaponSet(unsigned int index) const;
    9090            void addWeaponPack(WeaponPack * wPack);
     91            void addWeaponPackXML(WeaponPack * wPack);
    9192            WeaponPack * getWeaponPack(unsigned int index) const;
    9293
Note: See TracChangeset for help on using the changeset viewer.