Changeset 6107 for code/branches/presentation2/src/orxonox/weaponsystem
- Timestamp:
- Nov 20, 2009, 5:20:11 PM (15 years ago)
- Location:
- code/branches/presentation2
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2
- Property svn:mergeinfo changed
/code/branches/particles2 (added) merged: 6050,6059,6065-6068,6076,6078-6082,6086-6087,6098-6099,6101
- Property svn:mergeinfo changed
-
code/branches/presentation2/src/orxonox/weaponsystem/WeaponPack.cc
r5929 r6107 49 49 WeaponPack::~WeaponPack() 50 50 { 51 if (this->isInitialized() && this->weaponSystem_)51 if (this->isInitialized()) 52 52 { 53 this->weaponSystem_->removeWeaponPack(this); 53 if( this->weaponSystem_ ) 54 this->weaponSystem_->removeWeaponPack(this); 54 55 55 56 while (!this->weapons_.empty()) … … 71 72 void WeaponPack::fire(unsigned int weaponmode) 72 73 { 73 for (std:: set<Weapon *>::iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)74 for (std::vector<Weapon *>::iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it) 74 75 (*it)->fire(weaponmode); 75 76 } … … 77 78 void WeaponPack::reload() 78 79 { 79 for (std:: set<Weapon *>::iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)80 for (std::vector<Weapon *>::iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it) 80 81 (*it)->reload(); 81 82 } … … 86 87 return; 87 88 88 this->weapons_. insert(weapon);89 this->weapons_.push_back(weapon); 89 90 weapon->setWeaponPack(this); 90 91 } … … 95 96 return; 96 97 97 this->weapons_.erase(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); 98 101 weapon->setWeaponPack(0); 99 102 } … … 103 106 unsigned int i = 0; 104 107 105 for (std:: set<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)108 for (std::vector<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it) 106 109 { 107 110 if (i == index) … … 142 145 void WeaponPack::notifyWeapons() 143 146 { 144 for (std:: set<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)147 for (std::vector<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it) 145 148 (*it)->setWeaponPack(this); 146 149 } -
code/branches/presentation2/src/orxonox/weaponsystem/WeaponPack.h
r5781 r6107 69 69 void notifyWeapons(); 70 70 71 std:: set<Weapon *> weapons_;71 std::vector<Weapon *> weapons_; 72 72 std::set<DefaultWeaponmodeLink *> links_; 73 73 WeaponSystem * weaponSystem_; -
code/branches/presentation2/src/orxonox/weaponsystem/WeaponSystem.cc
r5929 r6107 202 202 } 203 203 204 this->weaponPacks_. insert(wPack);204 this->weaponPacks_.push_back(wPack); 205 205 wPack->setWeaponSystem(this); 206 206 … … 221 221 222 222 // Remove the WeaponPack from the WeaponSystem 223 this->weaponPacks_.erase(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); 224 226 } 225 227 … … 227 229 { 228 230 unsigned int i = 0; 229 for (std:: set<WeaponPack*>::const_iterator it = this->weaponPacks_.begin(); it != this->weaponPacks_.end(); ++it)231 for (std::vector<WeaponPack*>::const_iterator it = this->weaponPacks_.begin(); it != this->weaponPacks_.end(); ++it) 230 232 { 231 233 ++i; … … 258 260 259 261 // Check if the WeaponPack belongs to this WeaponSystem 260 std:: set<WeaponPack *>::iterator it1 = this->weaponPacks_.find(wPack);262 std::vector<WeaponPack *>::iterator it1 = std::find( this->weaponPacks_.begin(), this->weaponPacks_.end(), wPack ); 261 263 if (it1 == this->weaponPacks_.end()) 262 264 return; -
code/branches/presentation2/src/orxonox/weaponsystem/WeaponSystem.h
r5781 r6107 92 92 std::map<unsigned int, WeaponSet *> weaponSets_; 93 93 std::vector<WeaponSlot *> weaponSlots_; 94 std:: set<WeaponPack *> weaponPacks_;94 std::vector<WeaponPack *> weaponPacks_; 95 95 std::map<Identifier *, Munition *> munitions_; 96 96 Pawn * pawn_;
Note: See TracChangeset
for help on using the changeset viewer.