Changeset 11071 for code/trunk/src/orxonox/weaponsystem/WeaponPack.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/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 }
Note: See TracChangeset
for help on using the changeset viewer.