- Timestamp:
- Nov 21, 2015, 7:05:53 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v2/src/orxonox/weaponsystem/Munition.cc
r10768 r10821 55 55 Munition::~Munition() 56 56 { 57 for ( std::map<WeaponMode*, Magazine*>::iterator it = this->currentMagazines_.begin(); it != this->currentMagazines_.end(); ++it)58 delete it->second;57 for (auto & elem : this->currentMagazines_) 58 delete elem.second; 59 59 } 60 60 … … 268 268 { 269 269 // Return true if any of the current magazines is not full (loading counts as full although it returns 0 munition) 270 for ( std::map<WeaponMode*, Magazine*>::const_iterator it = this->currentMagazines_.begin(); it != this->currentMagazines_.end(); ++it)271 if ( it->second->munition_ < this->maxMunitionPerMagazine_ && it->second->bLoaded_)270 for (const auto & elem : this->currentMagazines_) 271 if (elem.second->munition_ < this->maxMunitionPerMagazine_ && elem.second->bLoaded_) 272 272 return true; 273 273 } … … 316 316 { 317 317 bool change = false; 318 for ( std::map<WeaponMode*, Magazine*>::iterator it = this->currentMagazines_.begin(); it != this->currentMagazines_.end(); ++it)318 for (auto & elem : this->currentMagazines_) 319 319 { 320 320 // Add munition if the magazine isn't full (but only to loaded magazines) 321 if (amount > 0 && it->second->munition_ < this->maxMunitionPerMagazine_ && it->second->bLoaded_)321 if (amount > 0 && elem.second->munition_ < this->maxMunitionPerMagazine_ && elem.second->bLoaded_) 322 322 { 323 it->second->munition_++;323 elem.second->munition_++; 324 324 amount--; 325 325 change = true;
Note: See TracChangeset
for help on using the changeset viewer.