Changeset 11071 for code/trunk/src/orxonox/weaponsystem/Weapon.cc
- Timestamp:
- Jan 17, 2016, 10:29:21 PM (8 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
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 }
Note: See TracChangeset
for help on using the changeset viewer.