Changeset 6078
- Timestamp:
- Nov 17, 2009, 1:36:21 AM (15 years ago)
- Location:
- code/branches/particles2/src/orxonox
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/particles2/src/orxonox/controllers/Controller.h
r5781 r6078 37 37 class _OrxonoxExport Controller : public BaseObject 38 38 { 39 // set friend classes to access setControllableEntity 40 friend class PlayerInfo; 41 friend class ControllableEntity; 42 39 43 public: 40 44 Controller(BaseObject* creator); … … 46 50 { return this->player_; } 47 51 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) 48 58 inline void setControllableEntity(ControllableEntity* entity) 49 59 { … … 54 64 } 55 65 } 56 inline ControllableEntity* getControllableEntity() const57 { return this->controllableEntity_; }58 virtual void changedControllableEntity() {}59 66 60 protected:61 67 PlayerInfo* player_; 62 68 ControllableEntity* controllableEntity_; -
code/branches/particles2/src/orxonox/weaponsystem/WeaponPack.cc
r6076 r6078 96 96 return; 97 97 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); 100 101 weapon->setWeaponPack(0); 101 102 } -
code/branches/particles2/src/orxonox/weaponsystem/WeaponSystem.cc
r6076 r6078 221 221 222 222 // 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); 225 226 } 226 227 -
code/branches/particles2/src/orxonox/worldentities/pawns/Pawn.cc
r5929 r6078 110 110 XMLPortObject(Pawn, WeaponSlot, "weaponslots", addWeaponSlot, getWeaponSlot, xmlelement, mode); 111 111 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); 113 113 } 114 114 … … 341 341 } 342 342 343 void Pawn::addWeaponPackXML(WeaponPack * wPack) 344 { 345 if (this->weaponSystem_) 346 if (!this->weaponSystem_->addWeaponPack(wPack)) 347 wPack->destroy(); 348 } 349 343 350 WeaponPack * Pawn::getWeaponPack(unsigned int index) const 344 351 { -
code/branches/particles2/src/orxonox/worldentities/pawns/Pawn.h
r5781 r6078 89 89 WeaponSet * getWeaponSet(unsigned int index) const; 90 90 void addWeaponPack(WeaponPack * wPack); 91 void addWeaponPackXML(WeaponPack * wPack); 91 92 WeaponPack * getWeaponPack(unsigned int index) const; 92 93
Note: See TracChangeset
for help on using the changeset viewer.