- Timestamp:
- Dec 25, 2009, 1:18:03 PM (15 years ago)
- Location:
- code/branches/pickup2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickup2
- Property svn:mergeinfo changed
-
code/branches/pickup2/src/orxonox/weaponsystem/WeaponPack.cc
r5929 r6412 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 }
Note: See TracChangeset
for help on using the changeset viewer.