Changeset 10916 for code/branches/cpp11_v2/src/orxonox/worldentities
- Timestamp:
- Dec 2, 2015, 11:22:03 PM (10 years ago)
- Location:
- code/branches/cpp11_v2/src/orxonox/worldentities
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v2/src/orxonox/worldentities/ControllableEntity.cc
r10821 r10916 165 165 { 166 166 unsigned int i = 0; 167 for ( const auto & elem: this->cameraPositions_)167 for (CameraPosition* cameraPosition : this->cameraPositions_) 168 168 { 169 169 if (i == index) 170 return (elem);170 return cameraPosition; 171 171 ++i; 172 172 } … … 180 180 181 181 unsigned int counter = 0; 182 for ( const auto & elem: this->cameraPositions_)183 { 184 if ( (elem)== this->currentCameraPosition_)182 for (CameraPosition* cameraPosition : this->cameraPositions_) 183 { 184 if (cameraPosition == this->currentCameraPosition_) 185 185 break; 186 186 counter++; … … 477 477 if (parent) 478 478 { 479 for ( auto & elem: this->cameraPositions_)480 if ( (elem)->getIsAbsolute())481 parent->attach( (elem));479 for (CameraPosition* cameraPosition : this->cameraPositions_) 480 if (cameraPosition->getIsAbsolute()) 481 parent->attach(cameraPosition); 482 482 } 483 483 } -
code/branches/cpp11_v2/src/orxonox/worldentities/EffectContainer.cc
r10821 r10916 89 89 { 90 90 unsigned int i = 0; 91 for ( const auto & elem: this->effects_)91 for (WorldEntity* effect : this->effects_) 92 92 if (i == index) 93 return (elem);93 return effect; 94 94 return nullptr; 95 95 } -
code/branches/cpp11_v2/src/orxonox/worldentities/WorldEntity.cc
r10821 r10916 233 233 234 234 // iterate over all children and change their activity as well 235 for ( const auto & elem: this->getAttachedObjects())235 for (WorldEntity* object : this->getAttachedObjects()) 236 236 { 237 237 if(!this->isActive()) 238 238 { 239 (elem)->bActiveMem_ = (elem)->isActive();240 (elem)->setActive(this->isActive());239 object->bActiveMem_ = object->isActive(); 240 object->setActive(this->isActive()); 241 241 } 242 242 else 243 243 { 244 (elem)->setActive((elem)->bActiveMem_);244 object->setActive(object->bActiveMem_); 245 245 } 246 246 } … … 259 259 { 260 260 // iterate over all children and change their visibility as well 261 for ( const auto & elem: this->getAttachedObjects())261 for (WorldEntity* object : this->getAttachedObjects()) 262 262 { 263 263 if(!this->isVisible()) 264 264 { 265 (elem)->bVisibleMem_ = (elem)->isVisible();266 (elem)->setVisible(this->isVisible());265 object->bVisibleMem_ = object->isVisible(); 266 object->setVisible(this->isVisible()); 267 267 } 268 268 else 269 269 { 270 (elem)->setVisible((elem)->bVisibleMem_);270 object->setVisible(object->bVisibleMem_); 271 271 } 272 272 } … … 518 518 { 519 519 unsigned int i = 0; 520 for ( const auto & elem: this->children_)520 for (WorldEntity* child : this->children_) 521 521 { 522 522 if (i == index) 523 return (elem);523 return child; 524 524 ++i; 525 525 } … … 938 938 // Recalculate mass 939 939 this->childrenMass_ = 0.0f; 940 for ( const auto & elem: this->children_)941 this->childrenMass_ += (elem)->getMass();940 for (WorldEntity* child : this->children_) 941 this->childrenMass_ += child->getMass(); 942 942 recalculateMassProps(); 943 943 // Notify parent WE -
code/branches/cpp11_v2/src/orxonox/worldentities/pawns/ModularSpaceShip.cc
r10821 r10916 99 99 } 100 100 // iterate through all attached parts 101 for( auto & elem: this->partList_)101 for(ShipPart* part : this->partList_) 102 102 { 103 103 // if the name of the part matches the name of the object, add the object to that parts entitylist (unless it was already done). 104 if(( elem->getName() == this->getAttachedObject(i)->getName()) && !elem->hasEntity(orxonox_cast<StaticEntity*>(this->getAttachedObject(i))))104 if((part->getName() == this->getAttachedObject(i)->getName()) && !part->hasEntity(orxonox_cast<StaticEntity*>(this->getAttachedObject(i)))) 105 105 { 106 106 // The Entity is added to the part's entityList_ 107 elem->addEntity(orxonox_cast<StaticEntity*>(this->getAttachedObject(i)));107 part->addEntity(orxonox_cast<StaticEntity*>(this->getAttachedObject(i))); 108 108 // An entry in the partMap_ is created, assigning the part to the entity. 109 this->addPartEntityAssignment((StaticEntity*)(this->getAttachedObject(i)), elem);109 this->addPartEntityAssignment((StaticEntity*)(this->getAttachedObject(i)), part); 110 110 } 111 111 } … … 146 146 ShipPart* ModularSpaceShip::getPartOfEntity(StaticEntity* entity) const 147 147 { 148 for (const auto & elem: this->partMap_)149 { 150 if ( elem.first == entity)151 return elem.second;148 for (const auto& mapEntry : this->partMap_) 149 { 150 if (mapEntry.first == entity) 151 return mapEntry.second; 152 152 } 153 153 return nullptr; … … 242 242 ShipPart* ModularSpaceShip::getShipPartByName(std::string name) 243 243 { 244 for( auto & elem: this->partList_)245 { 246 if(orxonox_cast<ShipPart*>( elem)->getName() == name)247 { 248 return orxonox_cast<ShipPart*>( elem);244 for(ShipPart* part : this->partList_) 245 { 246 if(orxonox_cast<ShipPart*>(part)->getName() == name) 247 { 248 return orxonox_cast<ShipPart*>(part); 249 249 } 250 250 } … … 256 256 @brief 257 257 Check whether the SpaceShip has a particular Engine. 258 @param engine258 @param search 259 259 A pointer to the Engine to be checked. 260 260 */ 261 bool ModularSpaceShip::hasShipPart(ShipPart* part) const262 { 263 for( auto & elem: this->partList_)264 { 265 if( elem == part)261 bool ModularSpaceShip::hasShipPart(ShipPart* search) const 262 { 263 for(ShipPart* part : this->partList_) 264 { 265 if(part == search) 266 266 return true; 267 267 } -
code/branches/cpp11_v2/src/orxonox/worldentities/pawns/SpaceShip.cc
r10821 r10916 158 158 159 159 // Run the engines 160 for( auto & elem: this->engineList_)161 (elem)->run(dt);160 for(Engine* engine : this->engineList_) 161 engine->run(dt); 162 162 163 163 if (this->hasLocalController()) … … 313 313 @brief 314 314 Check whether the SpaceShip has a particular Engine. 315 @param engine315 @param search 316 316 A pointer to the Engine to be checked. 317 317 */ 318 bool SpaceShip::hasEngine(Engine* engine) const319 { 320 for( auto & elem: this->engineList_)321 { 322 if(e lem == engine)318 bool SpaceShip::hasEngine(Engine* search) const 319 { 320 for(Engine* engine : this->engineList_) 321 { 322 if(engine == search) 323 323 return true; 324 324 } … … 350 350 Engine* SpaceShip::getEngineByName(const std::string& name) 351 351 { 352 for( auto & elem: this->engineList_)353 if(e lem->getName() == name)354 return e lem;352 for(Engine* engine : this->engineList_) 353 if(engine->getName() == name) 354 return engine; 355 355 356 356 orxout(internal_warning) << "Couldn't find Engine with name \"" << name << "\"." << endl; … … 396 396 void SpaceShip::addSpeedFactor(float factor) 397 397 { 398 for( auto & elem: this->engineList_)399 e lem->addSpeedMultiply(factor);398 for(Engine* engine : this->engineList_) 399 engine->addSpeedMultiply(factor); 400 400 } 401 401 … … 408 408 void SpaceShip::addSpeed(float speed) 409 409 { 410 for( auto & elem: this->engineList_)411 e lem->addSpeedAdd(speed);410 for(Engine* engine : this->engineList_) 411 engine->addSpeedAdd(speed); 412 412 } 413 413 … … 436 436 { 437 437 float speed=0; 438 for( auto & elem: this->engineList_)439 { 440 if(e lem->getMaxSpeedFront() > speed)441 speed = e lem->getMaxSpeedFront();438 for(Engine* engine : this->engineList_) 439 { 440 if(engine->getMaxSpeedFront() > speed) 441 speed = engine->getMaxSpeedFront(); 442 442 } 443 443 return speed; -
code/branches/cpp11_v2/src/orxonox/worldentities/pawns/TeamBaseMatchBase.cc
r10821 r10916 80 80 81 81 std::set<WorldEntity*> attachments = this->getAttachedObjects(); 82 for ( const auto &attachment : attachments)82 for (WorldEntity* attachment : attachments) 83 83 { 84 if ( (attachment)->isA(Class(TeamColourable)))84 if (attachment->isA(Class(TeamColourable))) 85 85 { 86 86 TeamColourable* tc = orxonox_cast<TeamColourable*>(attachment);
Note: See TracChangeset
for help on using the changeset viewer.