Changeset 11071 for code/trunk/src/orxonox/weaponsystem
- Timestamp:
- Jan 17, 2016, 10:29:21 PM (9 years ago)
- Location:
- code/trunk
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/weaponsystem/DefaultWeaponmodeLink.h
r9667 r11071 42 42 virtual ~DefaultWeaponmodeLink(); 43 43 44 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;44 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 45 45 46 46 inline void setFiremode(const unsigned int firemode) -
code/trunk/src/orxonox/weaponsystem/Munition.cc
r11052 r11071 52 52 this->reloadTime_ = 0.5f; 53 53 54 this->lastFilledWeaponMode_ = NULL;54 this->lastFilledWeaponMode_ = nullptr; 55 55 } 56 56 57 57 Munition::~Munition() 58 58 { 59 for ( std::map<WeaponMode*, Magazine*>::iterator it = this->assignedMagazines_.begin(); it != this->assignedMagazines_.end(); ++it)60 delete it->second;59 for (const auto& mapEntry : this->assignedMagazines_) 60 delete mapEntry.second; 61 61 } 62 62 … … 76 76 // For separated magazines we definitively need a given user 77 77 if (!user) 78 return 0;78 return nullptr; 79 79 80 80 // Use the map to get the magazine assigned to the given user … … 90 90 } 91 91 92 return 0;92 return nullptr; 93 93 } 94 94 … … 200 200 magazine->munition_ = 0; 201 201 202 if (this->reload( NULL))202 if (this->reload(nullptr)) 203 203 // Successfully reloaded, continue recursively 204 204 return this->takeMunition(amount, 0); … … 262 262 if (deployment_ != MunitionDeployment::Separate) 263 263 { 264 user = NULL;264 user = nullptr; 265 265 } 266 266 … … 271 271 if (it->first == lastFilledWeaponMode_) 272 272 { 273 lastFilledWeaponMode_ = NULL;273 lastFilledWeaponMode_ = nullptr; 274 274 } 275 275 delete it->second; … … 299 299 { 300 300 // Return true if any of the current magazines is not full (loading counts as full although it returns 0 munition) 301 for ( std::map<WeaponMode*, Magazine*>::const_iterator it = this->assignedMagazines_.begin(); it != this->assignedMagazines_.end(); ++it)302 if ( it->second->munition_ < this->maxMunitionPerMagazine_ && it->second->bLoaded_)301 for (const auto& mapEntry : this->assignedMagazines_) 302 if (mapEntry.second->munition_ < this->maxMunitionPerMagazine_ && mapEntry.second->bLoaded_) 303 303 return true; 304 304 } … … 315 315 { 316 316 // Stacking munition means, if a magazine gets full, the munition adds to a new magazine 317 Magazine* magazine = this->getMagazine( NULL);317 Magazine* magazine = this->getMagazine(nullptr); 318 318 if (magazine) 319 319 { … … 345 345 std::map<WeaponMode*, Magazine*>::iterator it; 346 346 347 // If the pointer to the weapon mode whose magazine got munition added to is NULL, then set the iterator to the beginning of the map347 // If the pointer to the weapon mode whose magazine got munition added to is nullptr, then set the iterator to the beginning of the map 348 348 // Otherwise set it to the next weapon mode 349 if (lastFilledWeaponMode_ == NULL)349 if (lastFilledWeaponMode_ == nullptr) 350 350 { 351 351 it = this->assignedMagazines_.begin(); … … 441 441 for (unsigned int i = 0; i < addedMagazines; ++i) 442 442 { 443 for ( std::map<WeaponMode*, Magazine*>::iterator it = this->assignedMagazines_.begin(); it != this->assignedMagazines_.end(); ++it)444 { 445 if (needReload( it->first))446 { 447 reload( it->first);443 for (const auto& mapEntry : this->assignedMagazines_) 444 { 445 if (needReload(mapEntry.first)) 446 { 447 reload(mapEntry.first); 448 448 break; 449 449 } … … 515 515 // If we don't use separate magazines, set user to 0 516 516 if (deployment_ != MunitionDeployment::Separate) 517 user = NULL;517 user = nullptr; 518 518 519 519 // Remove the current magazine for the given user … … 523 523 if (it->first == lastFilledWeaponMode_) 524 524 { 525 lastFilledWeaponMode_ = NULL;525 lastFilledWeaponMode_ = nullptr; 526 526 } 527 527 delete it->second; -
code/trunk/src/orxonox/weaponsystem/Munition.h
r11052 r11071 39 39 namespace orxonox 40 40 { 41 namespaceMunitionDeployment41 enum class MunitionDeployment 42 42 { 43 enum Value 44 { 45 Separate, // Every comsuming weapon mode has its own magazine. It is possible that one weapon mode is out of ammo while another still has some. 46 Share, // All comsuming weapon modes take their munition from the same magazine. If this magazine is empty a new one is loaded. 47 Stack // There is only one magazine where all the munition is stored. Use this deployment mode for heavy weapons loke rockets, bombs, ... 48 }; 49 } 43 Separate, // Every comsuming weapon mode has its own magazine. It is possible that one weapon mode is out of ammo while another still has some. 44 Share, // All comsuming weapon modes take their munition from the same magazine. If this magazine is empty a new one is loaded. 45 Stack // There is only one magazine where all the munition is stored. Use this deployment mode for heavy weapons loke rockets, bombs, ... 46 }; 50 47 51 48 class _OrxonoxExport Munition : public BaseObject … … 69 66 virtual ~Munition(); 70 67 71 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;68 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 72 69 73 70 unsigned int getNumMunition(WeaponMode* user) const; … … 80 77 inline unsigned int getMaxMunitionPerMagazine() const 81 78 { return this->maxMunitionPerMagazine_; } 82 inline MunitionDeployment ::ValuegetMunitionDeployment() const79 inline MunitionDeployment getMunitionDeployment() const 83 80 { return deployment_; } 84 81 … … 115 112 std::map<WeaponMode*, Magazine*> assignedMagazines_; // Maps weapon modes to magazines that are currently used. 116 113 117 MunitionDeployment ::Valuedeployment_; // Defines the behaviour how munition and magazines are distributed to the consuming weapon modes.114 MunitionDeployment deployment_; // Defines the behaviour how munition and magazines are distributed to the consuming weapon modes. 118 115 119 116 bool bAllowMunitionRefilling_; -
code/trunk/src/orxonox/weaponsystem/ReplenishingMunition.h
r11052 r11071 52 52 public: 53 53 ReplenishingMunition(Context* context); 54 virtual ~ReplenishingMunition() {}54 virtual ~ReplenishingMunition() = default; 55 55 56 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;56 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 57 57 58 virtualfloat getProgress();58 float getProgress(); 59 59 inline unsigned int getReplenishAmount() const 60 60 { return replenishAmount_; } -
code/trunk/src/orxonox/weaponsystem/Weapon.cc
r11052 r11071 45 45 RegisterObject(Weapon); 46 46 47 this->weaponPack_ = 0;48 this->weaponSlot_ = 0;47 this->weaponPack_ = nullptr; 48 this->weaponSlot_ = nullptr; 49 49 this->bReloading_ = false; 50 50 this->reloadingWeaponmode_ = WeaponSystem::WEAPON_MODE_UNASSIGNED; … … 61 61 this->weaponPack_->removeWeapon(this); 62 62 63 for ( std::multimap<unsigned int, WeaponMode*>::iterator it = this->weaponmodes_.begin(); it != this->weaponmodes_.end(); ++it)64 it->second->destroy();63 for (const auto& mapEntry : this->weaponmodes_) 64 mapEntry.second->destroy(); 65 65 } 66 66 } … … 85 85 { 86 86 unsigned int i = 0; 87 for ( std::multimap<unsigned int, WeaponMode*>::const_iterator it = this->weaponmodes_.begin(); it != this->weaponmodes_.end(); ++it)87 for (const auto& mapEntry : this->weaponmodes_) 88 88 { 89 89 if (i == index) 90 return it->second;90 return mapEntry.second; 91 91 92 92 ++i; 93 93 } 94 return 0;94 return nullptr; 95 95 } 96 96 … … 140 140 void Weapon::reload() 141 141 { 142 for ( std::multimap<unsigned int, WeaponMode*>::iterator it = this->weaponmodes_.begin(); it != this->weaponmodes_.end(); ++it)143 it->second->reload();142 for (const auto& mapEntry : this->weaponmodes_) 143 mapEntry.second->reload(); 144 144 } 145 145 … … 152 152 void Weapon::notifyWeaponModes() 153 153 { 154 for ( std::multimap<unsigned int, WeaponMode*>::iterator it = this->weaponmodes_.begin(); it != this->weaponmodes_.end(); ++it)155 it->second->setWeapon(this);154 for (const auto& mapEntry : this->weaponmodes_) 155 mapEntry.second->setWeapon(this); 156 156 } 157 157 158 158 void Weapon::updateMunition() 159 159 { 160 for ( std::multimap<unsigned int, WeaponMode*>::iterator it = this->weaponmodes_.begin(); it != this->weaponmodes_.end(); ++it)161 it->second->updateMunition();160 for (const auto& mapEnty : this->weaponmodes_) 161 mapEnty.second->updateMunition(); 162 162 } 163 163 } -
code/trunk/src/orxonox/weaponsystem/Weapon.h
r11052 r11071 50 50 virtual ~Weapon(); 51 51 52 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;52 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 53 53 54 54 void fire(unsigned int mode); … … 57 57 void addWeaponmode(WeaponMode* weaponmode); 58 58 WeaponMode* getWeaponmode(unsigned int index) const; 59 inline std::multimap<unsigned int, WeaponMode*>* getAllWeaponmodes()60 { return &weaponmodes_; }59 inline const std::multimap<unsigned int, WeaponMode*>& getAllWeaponmodes() const 60 { return weaponmodes_; } 61 61 inline int getNumWeaponModes() const 62 62 { return weaponmodes_.size(); } -
code/trunk/src/orxonox/weaponsystem/WeaponMode.cc
r11052 r11071 51 51 RegisterObject(WeaponMode); 52 52 53 this->weapon_ = 0;53 this->weapon_ = nullptr; 54 54 this->mode_ = WeaponSystem::WEAPON_MODE_UNASSIGNED; 55 55 56 this->munition_ = 0;56 this->munition_ = nullptr; 57 57 this->initialMunition_ = 0; 58 58 this->initialMagazines_ = 0; … … 244 244 else 245 245 { 246 this->munition_ = NULL;246 this->munition_ = nullptr; 247 247 } 248 248 } -
code/trunk/src/orxonox/weaponsystem/WeaponMode.h
r11052 r11071 52 52 virtual ~WeaponMode(); 53 53 54 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;54 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 55 55 56 56 bool fire(float* reloadTime); -
code/trunk/src/orxonox/weaponsystem/WeaponPack.cc
r11052 r11071 44 44 RegisterObject(WeaponPack); 45 45 46 this->weaponSystem_ = 0;46 this->weaponSystem_ = nullptr; 47 47 } 48 48 … … 76 76 void WeaponPack::fire(unsigned int weaponmode) 77 77 { 78 for ( std::vector<Weapon *>::iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)79 (*it)->fire(weaponmode);78 for (Weapon* weapon : this->weapons_) 79 weapon->fire(weaponmode); 80 80 } 81 81 … … 86 86 void WeaponPack::reload() 87 87 { 88 for ( std::vector<Weapon *>::iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)89 (*it)->reload();88 for (Weapon* weapon : this->weapons_) 89 weapon->reload(); 90 90 } 91 91 … … 107 107 assert(it != this->weapons_.end()); 108 108 this->weapons_.erase(it); 109 weapon->setWeaponPack( 0);109 weapon->setWeaponPack(nullptr); 110 110 } 111 111 … … 114 114 unsigned int i = 0; 115 115 116 for ( std::vector<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)116 for (Weapon* weapon : this->weapons_) 117 117 { 118 118 if (i == index) 119 return (*it);119 return weapon; 120 120 ++i; 121 121 } 122 122 123 return 0;123 return nullptr; 124 124 } 125 126 std::vector<Weapon*>* WeaponPack::getAllWeapons()127 {128 return &weapons_;129 }130 125 131 126 void WeaponPack::addDefaultWeaponmodeLink(DefaultWeaponmodeLink* link) … … 137 132 { 138 133 unsigned int i = 0; 139 for ( std::set<DefaultWeaponmodeLink*>::const_iterator it = this->links_.begin(); it != this->links_.end(); ++it)134 for (DefaultWeaponmodeLink* link : this->links_) 140 135 { 141 136 if (i == index) 142 return (*it);137 return link; 143 138 144 139 ++i; 145 140 } 146 return 0;141 return nullptr; 147 142 } 148 143 149 144 unsigned int WeaponPack::getDesiredWeaponmode(unsigned int firemode) const 150 145 { 151 for ( std::set<DefaultWeaponmodeLink*>::const_iterator it = this->links_.begin(); it != this->links_.end(); ++it)152 if ( (*it)->getFiremode() == firemode)153 return (*it)->getWeaponmode();146 for (DefaultWeaponmodeLink* link : this->links_) 147 if (link->getFiremode() == firemode) 148 return link->getWeaponmode(); 154 149 155 150 return WeaponSystem::WEAPON_MODE_UNASSIGNED; … … 158 153 void WeaponPack::notifyWeapons() 159 154 { 160 for ( std::vector<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)161 (*it)->setWeaponPack(this);155 for (Weapon* weapon : this->weapons_) 156 weapon->setWeaponPack(this); 162 157 } 163 158 164 159 void WeaponPack::updateMunition() 165 160 { 166 for ( std::vector<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)167 (*it)->updateMunition();161 for (Weapon* weapon : this->weapons_) 162 weapon->updateMunition(); 168 163 } 169 164 } -
code/trunk/src/orxonox/weaponsystem/WeaponPack.h
r11052 r11071 44 44 virtual ~WeaponPack(); 45 45 46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 47 47 48 48 void fire(unsigned int weaponmode); … … 52 52 void removeWeapon(Weapon * weapon); 53 53 Weapon * getWeapon(unsigned int index) const; 54 std::vector<Weapon*>* getAllWeapons(); 54 inline const std::vector<Weapon*>& getAllWeapons() const 55 { return weapons_; } 55 56 56 57 inline size_t getNumWeapons() const -
code/trunk/src/orxonox/weaponsystem/WeaponSet.cc
r10650 r11071 43 43 RegisterObject(WeaponSet); 44 44 45 this->weaponSystem_ = 0;45 this->weaponSystem_ = nullptr; 46 46 this->desiredFiremode_ = WeaponSystem::FIRE_MODE_UNASSIGNED; 47 47 } … … 63 63 { 64 64 // Fire all WeaponPacks with their defined weaponmode 65 for ( std::map<WeaponPack*, unsigned int>::iterator it = this->weaponpacks_.begin(); it != this->weaponpacks_.end(); ++it)66 if ( it->second != WeaponSystem::WEAPON_MODE_UNASSIGNED)67 it->first->fire(it->second);65 for (const auto& mapEntry : this->weaponpacks_) 66 if (mapEntry.second != WeaponSystem::WEAPON_MODE_UNASSIGNED) 67 mapEntry.first->fire(mapEntry.second); 68 68 } 69 69 … … 71 71 { 72 72 // Reload all WeaponPacks with their defined weaponmode 73 for ( std::map<WeaponPack*, unsigned int>::iterator it = this->weaponpacks_.begin(); it != this->weaponpacks_.end(); ++it)74 it->first->reload();73 for (const auto& mapEntry : this->weaponpacks_) 74 mapEntry.first->reload(); 75 75 } 76 76 -
code/trunk/src/orxonox/weaponsystem/WeaponSet.h
r9667 r11071 44 44 virtual ~WeaponSet(); 45 45 46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 47 47 48 48 void fire(); -
code/trunk/src/orxonox/weaponsystem/WeaponSlot.cc
r10648 r11071 43 43 RegisterObject(WeaponSlot); 44 44 45 this->weaponSystem_ = 0;46 this->weapon_ = 0;45 this->weaponSystem_ = nullptr; 46 this->weapon_ = nullptr; 47 47 48 48 this->setSyncMode(ObjectDirection::None); … … 88 88 if (this->weapon_) 89 89 { 90 this->weapon_->setWeaponSlot( 0);91 this->weapon_ = 0;90 this->weapon_->setWeaponSlot(nullptr); 91 this->weapon_ = nullptr; 92 92 } 93 93 } -
code/trunk/src/orxonox/weaponsystem/WeaponSlot.h
r10650 r11071 62 62 virtual ~WeaponSlot(); 63 63 64 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;64 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 65 65 66 66 void attachWeapon(Weapon * weapon); … … 74 74 */ 75 75 inline bool isOccupied() const 76 { return (this->weapon_ != 0); }76 { return (this->weapon_ != nullptr); } 77 77 78 78 inline void setWeaponSystem(WeaponSystem * weaponSystem) -
code/trunk/src/orxonox/weaponsystem/WeaponSystem.cc
r11052 r11071 52 52 RegisterObject(WeaponSystem); 53 53 54 this->pawn_ = 0;54 this->pawn_ = nullptr; 55 55 } 56 56 … … 60 60 { 61 61 if (this->pawn_) 62 this->pawn_->setWeaponSystem( 0);62 this->pawn_->setWeaponSystem(nullptr); 63 63 64 64 while (!this->weaponSets_.empty()) … … 106 106 { 107 107 unsigned int i = 0; 108 for ( std::vector<WeaponSlot*>::const_iterator it = this->weaponSlots_.begin(); it != this->weaponSlots_.end(); ++it)108 for (WeaponSlot* weaponSlot : this->weaponSlots_) 109 109 { 110 110 ++i; 111 111 if (i > index) 112 return (*it);113 } 114 return 0;112 return weaponSlot; 113 } 114 return nullptr; 115 115 } 116 116 … … 153 153 { 154 154 unsigned int i = 0; 155 for ( std::map<unsigned int, WeaponSet*>::const_iterator it = this->weaponSets_.begin(); it != this->weaponSets_.end(); ++it)155 for (const auto& mapEntry : this->weaponSets_) 156 156 { 157 157 ++i; 158 158 if (i > index) 159 return it->second;160 } 161 return 0;159 return mapEntry.second; 160 } 161 return nullptr; 162 162 } 163 163 … … 168 168 169 169 unsigned int freeSlots = 0; 170 for ( std::vector<WeaponSlot*>::iterator it = this->weaponSlots_.begin(); it != this->weaponSlots_.end(); ++it)171 { 172 if (! (*it)->isOccupied())170 for (WeaponSlot* weaponSlot : this->weaponSlots_) 171 { 172 if (!weaponSlot->isOccupied()) 173 173 ++freeSlots; 174 174 } … … 184 184 // Attach all weapons to the first free slots (and to the Pawn) 185 185 unsigned int i = 0; 186 for ( std::vector<WeaponSlot*>::iterator it = this->weaponSlots_.begin(); it != this->weaponSlots_.end(); ++it)187 { 188 if (! (*it)->isOccupied() && i < wPack->getNumWeapons())186 for (WeaponSlot* weaponSlot : this->weaponSlots_) 187 { 188 if (!weaponSlot->isOccupied() && i < wPack->getNumWeapons()) 189 189 { 190 190 Weapon* weapon = wPack->getWeapon(i); 191 (*it)->attachWeapon(weapon);191 weaponSlot->attachWeapon(weapon); 192 192 this->getPawn()->attach(weapon); 193 193 ++i; … … 196 196 197 197 // Assign the desired weaponmode to the firemodes 198 for ( std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.begin(); it != this->weaponSets_.end(); ++it)199 { 200 unsigned int weaponmode = wPack->getDesiredWeaponmode( it->first);198 for (const auto& mapEntry : this->weaponSets_) 199 { 200 unsigned int weaponmode = wPack->getDesiredWeaponmode(mapEntry.first); 201 201 if (weaponmode != WeaponSystem::WEAPON_MODE_UNASSIGNED) 202 it->second->setWeaponmodeLink(wPack, weaponmode);202 mapEntry.second->setWeaponmodeLink(wPack, weaponmode); 203 203 } 204 204 … … 213 213 // Remove all weapons from their WeaponSlot 214 214 unsigned int i = 0; 215 Weapon* weapon = 0;215 Weapon* weapon = nullptr; 216 216 while ((weapon = wPack->getWeapon(i++))) 217 217 if (weapon->getWeaponSlot()) … … 219 219 220 220 // Remove all added links from the WeaponSets 221 for ( std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.begin(); it != this->weaponSets_.end(); ++it)222 it->second->removeWeaponmodeLink(wPack);221 for (const auto& mapEntry : this->weaponSets_) 222 mapEntry.second->removeWeaponmodeLink(wPack); 223 223 224 224 // Remove the WeaponPack from the WeaponSystem … … 231 231 { 232 232 unsigned int i = 0; 233 for ( std::vector<WeaponPack*>::const_iterator it = this->weaponPacks_.begin(); it != this->weaponPacks_.end(); ++it)233 for (WeaponPack* weaponPack : this->weaponPacks_) 234 234 { 235 235 ++i; 236 236 if (i > index) 237 return (*it); 238 } 239 return 0; 240 } 241 242 std::vector<WeaponPack *> * WeaponSystem::getAllWeaponPacks() 243 { 244 return &weaponPacks_; 245 } 237 return weaponPack; 238 } 239 return nullptr; 240 } 246 241 247 242 bool WeaponSystem::swapWeaponSlots(WeaponSlot * wSlot1, WeaponSlot * wSlot2) … … 273 268 // Check if the WeaponSet belongs to this WeaponSystem 274 269 bool foundWeaponSet = false; 275 for ( std::map<unsigned int, WeaponSet *>::iterator it2 = this->weaponSets_.begin(); it2 != this->weaponSets_.end(); ++it2)276 { 277 if ( it2->second == wSet)270 for (const auto& mapEntry : this->weaponSets_) 271 { 272 if (mapEntry.second == wSet) 278 273 { 279 274 foundWeaponSet = true; … … 301 296 void WeaponSystem::reload() 302 297 { 303 for ( std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.begin(); it != this->weaponSets_.end(); ++it)304 it->second->reload();298 for (const auto& mapEntry : this->weaponSets_) 299 mapEntry.second->reload(); 305 300 } 306 301 … … 308 303 { 309 304 if (!identifier || !identifier->getIdentifier()) 310 return 0;305 return nullptr; 311 306 312 307 std::map<Identifier *, Munition *>::iterator it = this->munitions_.find(identifier->getIdentifier()); … … 317 312 else 318 313 { 319 return NULL;314 return nullptr; 320 315 } 321 316 } … … 323 318 void WeaponSystem::addMunition(Munition* munition) 324 319 { 325 if (munition == NULL)320 if (munition == nullptr) 326 321 { 327 322 return; … … 337 332 else 338 333 { 339 orxout(internal_warning) << "Adding munition failed. identifier == NULL" << endl;334 orxout(internal_warning) << "Adding munition failed. identifier == nullptr " << endl; 340 335 } 341 336 } … … 343 338 void WeaponSystem::updateMunition() 344 339 { 345 for ( std::vector<WeaponPack*>::iterator it = this->weaponPacks_.begin(); it != this->weaponPacks_.end(); ++it)346 { 347 (*it)->updateMunition();340 for (WeaponPack* weaponPack : this->weaponPacks_) 341 { 342 weaponPack->updateMunition(); 348 343 } 349 344 } -
code/trunk/src/orxonox/weaponsystem/WeaponSystem.h
r11052 r11071 67 67 void removeWeaponPack(WeaponPack * wPack); 68 68 WeaponPack * getWeaponPack(unsigned int index) const; 69 std::vector<WeaponPack *> * getAllWeaponPacks(); 69 inline const std::vector<WeaponPack *>& getAllWeaponPacks() const 70 { return weaponPacks_; } 70 71 71 72 // configure slots and firemodes
Note: See TracChangeset
for help on using the changeset viewer.