Changeset 10919 for code/branches/cpp11_v2/src/orxonox/worldentities/pawns
- Timestamp:
- Dec 5, 2015, 10:47:51 PM (9 years ago)
- Location:
- code/branches/cpp11_v2/src/orxonox/worldentities/pawns
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v2/src/orxonox/worldentities/pawns/ModularSpaceShip.cc
r10916 r10919 174 174 void ModularSpaceShip::killShipPartStatic(std::string name) 175 175 { 176 for ( std::map<StaticEntity*, ShipPart*>::const_iterator it = ModularSpaceShip::partMap_s->begin(); it != ModularSpaceShip::partMap_s->end(); ++it)177 { 178 if ( it->second->getName() == name)179 { 180 it->second->death();176 for (const auto& mapEntry : *ModularSpaceShip::partMap_s) 177 { 178 if (mapEntry.second->getName() == name) 179 { 180 mapEntry.second->death(); 181 181 return; 182 182 } … … 193 193 void ModularSpaceShip::killShipPart(std::string name) 194 194 { 195 for ( std::map<StaticEntity*, ShipPart*>::const_iterator it = ModularSpaceShip::partMap_.begin(); it != ModularSpaceShip::partMap_.end(); ++it)196 { 197 if ( it->second->getName() == name)198 { 199 it->second->death();195 for (const auto& mapEntry : ModularSpaceShip::partMap_) 196 { 197 if (mapEntry.second->getName() == name) 198 { 199 mapEntry.second->death(); 200 200 return; 201 201 } -
code/branches/cpp11_v2/src/orxonox/worldentities/pawns/Pawn.cc
r10768 r10919 574 574 bool Pawn::hasSlaves() 575 575 { 576 for (ObjectList<FormationController>::iterator it = 577 ObjectList<FormationController>::begin(); 578 it != ObjectList<FormationController>::end(); ++it ) 576 for (FormationController* controller : ObjectList<FormationController>()) 579 577 { 580 578 // checks if the pawn's controller has a slave 581 if (this->hasHumanController() && it->getMaster() == this->getPlayer()->getController())579 if (this->hasHumanController() && controller->getMaster() == this->getPlayer()->getController()) 582 580 return true; 583 581 } … … 587 585 // A function that returns a slave of the pawn's controller 588 586 Controller* Pawn::getSlave(){ 589 for (ObjectList<FormationController>::iterator it = 590 ObjectList<FormationController>::begin(); 591 it != ObjectList<FormationController>::end(); ++it ) 592 { 593 if (this->hasHumanController() && it->getMaster() == this->getPlayer()->getController()) 594 return it->getController(); 587 for (FormationController* controller : ObjectList<FormationController>()) 588 { 589 if (this->hasHumanController() && controller->getMaster() == this->getPlayer()->getController()) 590 return controller->getController(); 595 591 } 596 592 return nullptr; -
code/branches/cpp11_v2/src/orxonox/worldentities/pawns/TeamBaseMatchBase.cc
r10916 r10919 92 92 93 93 // Call this so bots stop shooting at the base after they converted it 94 for ( ObjectList<ArtificialController>::iterator it = ObjectList<ArtificialController>::begin(); it != ObjectList<ArtificialController>::end(); ++it)95 it->abandonTarget(this);94 for (ArtificialController* controller : ObjectList<ArtificialController>()) 95 controller->abandonTarget(this); 96 96 } 97 97 }
Note: See TracChangeset
for help on using the changeset viewer.