Changeset 10919 for code/branches/cpp11_v2/src/orxonox
- Timestamp:
- Dec 5, 2015, 10:47:51 PM (9 years ago)
- Location:
- code/branches/cpp11_v2/src/orxonox
- Files:
-
- 28 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v2/src/orxonox/LevelManager.cc
r10916 r10919 78 78 { 79 79 // Delete all the LevelInfoItem objects because the LevelManager created them 80 std::set<LevelInfoItem*, LevelInfoCompare>::iterator it = availableLevels_.begin(); 81 for (; it != availableLevels_.end(); ++it) 82 delete *it; 80 for (LevelInfoItem* info : availableLevels_) 81 delete info; 83 82 } 84 83 … … 279 278 280 279 // Find the LevelInfo object we've just loaded (if there was one) 281 for( ObjectList<LevelInfo>::iterator item = ObjectList<LevelInfo>::begin(); item != ObjectList<LevelInfo>::end(); ++item)282 if( item->getXMLFilename() == *it)283 info = item->copy();280 for(LevelInfo* levelInfo : ObjectList<LevelInfo>()) 281 if(levelInfo->getXMLFilename() == *it) 282 info = levelInfo->copy(); 284 283 285 284 // We don't need the loaded stuff anymore -
code/branches/cpp11_v2/src/orxonox/MoodManager.cc
r10624 r10919 103 103 /*static*/ void MoodListener::changedMood(const std::string& mood) 104 104 { 105 for ( ObjectList<MoodListener>::iterator it = ObjectList<MoodListener>::begin(); it; ++it)106 it->moodChanged(mood);105 for (MoodListener* listener : ObjectList<MoodListener>()) 106 listener->moodChanged(mood); 107 107 } 108 108 } -
code/branches/cpp11_v2/src/orxonox/PlayerManager.cc
r10768 r10919 111 111 else 112 112 { 113 for ( ObjectList<PlayerInfo>::iterator it = ObjectList<PlayerInfo>::begin(); it != ObjectList<PlayerInfo>::end(); ++it)114 if (i t->getClientID() == clientID)115 return (*it);113 for (PlayerInfo* info : ObjectList<PlayerInfo>()) 114 if (info->getClientID() == clientID) 115 return info; 116 116 } 117 117 return nullptr; -
code/branches/cpp11_v2/src/orxonox/Radar.cc
r10768 r10919 84 84 this->radarObjects_.insert(rv); 85 85 // iterate through all radarlisteners and notify them 86 for ( ObjectList<RadarListener>::iterator itListener = ObjectList<RadarListener>::begin(); itListener; ++itListener)87 { 88 (*itListener)->addObject(rv);86 for (RadarListener* listener : ObjectList<RadarListener>()) 87 { 88 listener->addObject(rv); 89 89 } 90 90 } … … 95 95 this->radarObjects_.erase(rv); 96 96 // iterate through all radarlisteners and notify them 97 for ( ObjectList<RadarListener>::iterator itListener = ObjectList<RadarListener>::begin(); itListener; ++itListener)98 { 99 (*itListener)->removeObject(rv);97 for (RadarListener* listener : ObjectList<RadarListener>()) 98 { 99 listener->removeObject(rv); 100 100 } 101 101 } … … 130 130 } 131 131 132 for ( ObjectList<RadarListener>::iterator itListener = ObjectList<RadarListener>::begin(); itListener; ++itListener)133 { 134 (*itListener)->radarTick(dt);132 for (RadarListener* listener : ObjectList<RadarListener>()) 133 { 134 listener->radarTick(dt); 135 135 } 136 136 } … … 200 200 // iterate through all Radar Objects 201 201 unsigned int i = 0; 202 for (ObjectList<RadarViewable>::iterator it = ObjectList<RadarViewable>::begin(); it; ++it, ++i) 203 { 204 orxout(debug_output) << i++ << ": " << (*it)->getRVWorldPosition() << endl; 202 for (RadarViewable* viewable : ObjectList<RadarViewable>()) 203 { 204 orxout(debug_output) << i++ << ": " << viewable->getRVWorldPosition() << endl; 205 ++i; 205 206 } 206 207 } … … 208 209 void Radar::radarObjectChanged(RadarViewable* rv) 209 210 { 210 for ( ObjectList<RadarListener>::iterator itListener = ObjectList<RadarListener>::begin(); itListener; ++itListener)211 { 212 (*itListener)->objectChanged(rv);211 for (RadarListener* listener : ObjectList<RadarListener>()) 212 { 213 listener->objectChanged(rv); 213 214 } 214 215 } -
code/branches/cpp11_v2/src/orxonox/Scene.cc
r10916 r10919 389 389 /*static*/ void Scene::consoleCommand_debugDrawPhysics(bool bDraw, bool bFill, float fillAlpha) 390 390 { 391 for ( ObjectListIterator<Scene> it = ObjectList<Scene>::begin(); it != ObjectList<Scene>::end(); ++it)392 it->setDebugDrawPhysics(bDraw, bFill, fillAlpha);391 for (Scene* scene : ObjectList<Scene>()) 392 scene->setDebugDrawPhysics(bDraw, bFill, fillAlpha); 393 393 } 394 394 } -
code/branches/cpp11_v2/src/orxonox/chat/ChatHistory.cc
r10818 r10919 160 160 void ChatHistory::debug_printhist() 161 161 { 162 /* create deque iterator */163 std::deque<std::string>::iterator it;164 165 162 /* output all the strings */ 166 for( it = this->hist_buffer.begin(); it != this->hist_buffer.end(); 167 ++it ) 168 orxout(debug_output) << *it << endl; 163 for( const std::string& hist : this->hist_buffer ) 164 orxout(debug_output) << hist << endl; 169 165 170 166 /* output size */ -
code/branches/cpp11_v2/src/orxonox/collisionshapes/CompoundCollisionShape.cc
r10917 r10919 200 200 bool bEmpty = true; // Whether the CompoundCollisionShape is empty. 201 201 // Iterate over all CollisionShapes that belong to this CompoundCollisionShape. 202 for ( std::map<CollisionShape*, btCollisionShape*>::const_iterator it = this->attachedShapes_.begin(); it != this->attachedShapes_.end(); ++it)202 for (const auto& mapEntry : this->attachedShapes_) 203 203 { 204 204 // TODO: Make sure this is correct. 205 if ( it->second)205 if (mapEntry.second) 206 206 { 207 207 bEmpty = false; 208 if (! it->first->hasTransform() && bPrimitive)209 primitive = it->second;208 if (!mapEntry.first->hasTransform() && bPrimitive) 209 primitive = mapEntry.second; 210 210 else 211 211 { -
code/branches/cpp11_v2/src/orxonox/controllers/FormationController.cc
r10916 r10919 97 97 this->removeFromFormation(); 98 98 99 for ( ObjectList<FormationController>::iterator it = ObjectList<FormationController>::begin(); it; ++it)100 { 101 if ( *it!= this)99 for (FormationController* controller : ObjectList<FormationController>()) 100 { 101 if (controller != this) 102 102 { 103 if ( it->myMaster_ == this)103 if (controller->myMaster_ == this) 104 104 { 105 orxout(internal_error) << this << " is still master in " << (*it)<< endl;106 it->myMaster_ = nullptr;105 orxout(internal_error) << this << " is still master in " << controller << endl; 106 controller->myMaster_ = nullptr; 107 107 } 108 108 109 109 while (true) 110 110 { 111 std::vector<FormationController*>::iterator it2 = std::find( it->slaves_.begin(), it->slaves_.end(), this);112 if (it2 != it->slaves_.end())111 std::vector<FormationController*>::iterator it2 = std::find(controller->slaves_.begin(), controller->slaves_.end(), this); 112 if (it2 != controller->slaves_.end()) 113 113 { 114 orxout(internal_error) << this << " is still slave in " << (*it)<< endl;115 it->slaves_.erase(it2);114 orxout(internal_error) << this << " is still slave in " << controller << endl; 115 controller->slaves_.erase(it2); 116 116 } 117 117 else … … 140 140 void FormationController::formationflight(const bool form) 141 141 { 142 for ( ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)142 for (Pawn* pawn : ObjectList<Pawn>()) 143 143 { 144 144 Controller* controller = nullptr; 145 145 146 if ( it->getController())147 controller = it->getController();148 else if ( it->getXMLController())149 controller = it->getXMLController();146 if (pawn->getController()) 147 controller = pawn->getController(); 148 else if (pawn->getXMLController()) 149 controller = pawn->getXMLController(); 150 150 151 151 if (!controller) … … 171 171 void FormationController::masteraction(const int action) 172 172 { 173 for ( ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)173 for (Pawn* pawn : ObjectList<Pawn>()) 174 174 { 175 175 Controller* controller = nullptr; 176 176 177 if ( it->getController())178 controller = it->getController();179 else if ( it->getXMLController())180 controller = it->getXMLController();177 if (pawn->getController()) 178 controller = pawn->getController(); 179 else if (pawn->getXMLController()) 180 controller = pawn->getXMLController(); 181 181 182 182 if (!controller) … … 201 201 void FormationController::passivebehaviour(const bool passive) 202 202 { 203 for ( ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)203 for (Pawn* pawn : ObjectList<Pawn>()) 204 204 { 205 205 Controller* controller = nullptr; 206 206 207 if ( it->getController())208 controller = it->getController();209 else if ( it->getXMLController())210 controller = it->getXMLController();207 if (pawn->getController()) 208 controller = pawn->getController(); 209 else if (pawn->getXMLController()) 210 controller = pawn->getXMLController(); 211 211 212 212 if (!controller) … … 228 228 void FormationController::formationsize(const int size) 229 229 { 230 for ( ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)230 for (Pawn* pawn : ObjectList<Pawn>()) 231 231 { 232 232 Controller* controller = nullptr; 233 233 234 if ( it->getController())235 controller = it->getController();236 else if ( it->getXMLController())237 controller = it->getXMLController();234 if (pawn->getController()) 235 controller = pawn->getController(); 236 else if (pawn->getXMLController()) 237 controller = pawn->getXMLController(); 238 238 239 239 if (!controller) … … 398 398 int teamSize = 0; 399 399 //go through all pawns 400 for ( ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)400 for (Pawn* pawn : ObjectList<Pawn>()) 401 401 { 402 402 … … 405 405 if (!gt) 406 406 { 407 gt= it->getGametype();408 } 409 if (!FormationController::sameTeam(this->getControllableEntity(), static_cast<ControllableEntity*>( *it),gt))407 gt=pawn->getGametype(); 408 } 409 if (!FormationController::sameTeam(this->getControllableEntity(), static_cast<ControllableEntity*>(pawn),gt)) 410 410 continue; 411 411 … … 413 413 Controller* controller = nullptr; 414 414 415 if ( it->getController())416 controller = it->getController();417 else if ( it->getXMLController())418 controller = it->getXMLController();415 if (pawn->getController()) 416 controller = pawn->getController(); 417 else if (pawn->getXMLController()) 418 controller = pawn->getXMLController(); 419 419 420 420 if (!controller) … … 422 422 423 423 //is pawn oneself? 424 if (orxonox_cast<ControllableEntity*>( *it) == this->getControllableEntity())424 if (orxonox_cast<ControllableEntity*>(pawn) == this->getControllableEntity()) 425 425 continue; 426 426 … … 433 433 continue; 434 434 435 float distance = ( it->getPosition() - this->getControllableEntity()->getPosition()).length();435 float distance = (pawn->getPosition() - this->getControllableEntity()->getPosition()).length(); 436 436 437 437 // is pawn in range? … … 520 520 newMaster->myMaster_ = nullptr; 521 521 522 for( std::vector<FormationController*>::iterator it = newMaster->slaves_.begin(); it != newMaster->slaves_.end(); it++)523 { 524 (*it)->myMaster_ = newMaster;522 for(FormationController* slave : newMaster->slaves_) 523 { 524 slave->myMaster_ = newMaster; 525 525 } 526 526 } … … 549 549 newMaster->myMaster_ = nullptr; 550 550 551 for( std::vector<FormationController*>::iterator it = newMaster->slaves_.begin(); it != newMaster->slaves_.end(); it++)551 for(FormationController* slave : newMaster->slaves_) 552 552 { 553 (*it)->myMaster_ = newMaster;553 slave->myMaster_ = newMaster; 554 554 } 555 555 } … … 777 777 std::vector<FormationController*> allMasters; 778 778 779 for ( ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)779 for (Pawn* pawn : ObjectList<Pawn>()) 780 780 { 781 781 Controller* controller = nullptr; 782 782 783 if ( it->getController())784 controller = it->getController();785 else if ( it->getXMLController())786 controller = it->getXMLController();783 if (pawn->getController()) 784 controller = pawn->getController(); 785 else if (pawn->getXMLController()) 786 controller = pawn->getXMLController(); 787 787 788 788 if (!controller) … … 791 791 currentHumanController = orxonox_cast<NewHumanController*>(controller); 792 792 793 if(currentHumanController) humanPawn = *it;793 if(currentHumanController) humanPawn = pawn; 794 794 795 795 FormationController *aiController = orxonox_cast<FormationController*>(controller); … … 808 808 int i = 0; 809 809 810 for( std::vector<FormationController*>::iterator it = allMasters.begin(); it != allMasters.end(); it++, i++)811 { 812 if (!FormationController::sameTeam( (*it)->getControllableEntity(), humanPawn, (*it)->getGametype())) continue;813 distance = posHuman - (*it)->getControllableEntity()->getPosition().length();810 for(FormationController* master : allMasters) 811 { 812 if (!FormationController::sameTeam(master->getControllableEntity(), humanPawn, master->getGametype())) continue; 813 distance = posHuman - master->getControllableEntity()->getPosition().length(); 814 814 if(distance < minDistance) index = i; 815 i++; 815 816 } 816 817 allMasters[index]->followInit(humanPawn); … … 847 848 NewHumanController *currentHumanController = nullptr; 848 849 849 for ( ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)850 { 851 if (! it->getController())852 continue; 853 854 currentHumanController = orxonox_cast<NewHumanController*>( it->getController());850 for (Pawn* pawn : ObjectList<Pawn>()) 851 { 852 if (!pawn->getController()) 853 continue; 854 855 currentHumanController = orxonox_cast<NewHumanController*>(pawn->getController()); 855 856 if(currentHumanController) 856 857 { 857 if (!FormationController::sameTeam(this->getControllableEntity(), *it, this->getGametype())) continue;858 humanPawn = *it;858 if (!FormationController::sameTeam(this->getControllableEntity(), pawn, this->getGametype())) continue; 859 humanPawn = pawn; 859 860 break; 860 861 } … … 918 919 this->forgetTarget(); 919 920 920 for ( ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)921 { 922 if (FormationController::sameTeam(this->getControllableEntity(), static_cast<ControllableEntity*>( *it), this->getGametype()))921 for (Pawn* pawn : ObjectList<Pawn>()) 922 { 923 if (FormationController::sameTeam(this->getControllableEntity(), static_cast<ControllableEntity*>(pawn), this->getGametype())) 923 924 continue; 924 925 925 926 /* So AI won't choose invisible Spaceships as target */ 926 if (! it->getRadarVisibility())927 continue; 928 929 if (static_cast<ControllableEntity*>( *it) != this->getControllableEntity())927 if (!pawn->getRadarVisibility()) 928 continue; 929 930 if (static_cast<ControllableEntity*>(pawn) != this->getControllableEntity()) 930 931 { 931 932 float speed = this->getControllableEntity()->getVelocity().length(); 932 933 Vector3 distanceCurrent = this->targetPosition_ - this->getControllableEntity()->getPosition(); 933 Vector3 distanceNew = it->getPosition() - this->getControllableEntity()->getPosition();934 if (!this->target_ || it->getPosition().squaredDistance(this->getControllableEntity()->getPosition()) * (1.5f + acos((this->getControllableEntity()->getOrientation() * WorldEntity::FRONT).dotProduct(distanceNew) / speed / distanceNew.length()) / math::twoPi)934 Vector3 distanceNew = pawn->getPosition() - this->getControllableEntity()->getPosition(); 935 if (!this->target_ || pawn->getPosition().squaredDistance(this->getControllableEntity()->getPosition()) * (1.5f + acos((this->getControllableEntity()->getOrientation() * WorldEntity::FRONT).dotProduct(distanceNew) / speed / distanceNew.length()) / math::twoPi) 935 936 < this->targetPosition_.squaredDistance(this->getControllableEntity()->getPosition()) * (1.5f + acos((this->getControllableEntity()->getOrientation() * WorldEntity::FRONT).dotProduct(distanceCurrent) / speed / distanceCurrent.length()) / math::twoPi) + rnd(-250, 250)) 936 937 { 937 this->setTarget( *it);938 this->setTarget(pawn); 938 939 } 939 940 } -
code/branches/cpp11_v2/src/orxonox/controllers/ScriptController.cc
r10765 r10919 121 121 122 122 /* Debugging: print all the scriptcontroller object pointers */ 123 for(ObjectList<ScriptController>::iterator it = 124 ObjectList<ScriptController>::begin(); 125 it != ObjectList<ScriptController>::end(); ++it) 126 { orxout(verbose) << "Have object in list: " << *it << endl; } 123 for(ScriptController* controller : ObjectList<ScriptController>()) 124 { orxout(verbose) << "Have object in list: " << controller << endl; } 127 125 128 126 /* Find the first one with a nonzero ID */ 129 for(ObjectList<ScriptController>::iterator it = 130 ObjectList<ScriptController>::begin(); 131 it != ObjectList<ScriptController>::end(); ++it) 127 for(ScriptController* controller : ObjectList<ScriptController>()) 132 128 { 133 129 // TODO: do some selection here. Currently just returns the first one 134 if( (*it)->getID() > 0 )135 { orxout(verbose) << "Controller to return: " << *it<< endl;136 return *it;130 if( controller->getID() > 0 ) 131 { orxout(verbose) << "Controller to return: " << controller << endl; 132 return controller; 137 133 } 138 134 -
code/branches/cpp11_v2/src/orxonox/controllers/WaypointPatrolController.cc
r10768 r10919 87 87 float shortestsqdistance = (float)static_cast<unsigned int>(-1); 88 88 89 for ( ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)89 for (Pawn* pawn : ObjectList<Pawn>()) 90 90 { 91 if (ArtificialController::sameTeam(this->getControllableEntity(), static_cast<ControllableEntity*>( *it), this->getGametype()))91 if (ArtificialController::sameTeam(this->getControllableEntity(), static_cast<ControllableEntity*>(pawn), this->getGametype())) 92 92 continue; 93 93 94 float sqdistance = it->getPosition().squaredDistance(myposition);94 float sqdistance = pawn->getPosition().squaredDistance(myposition); 95 95 if (sqdistance < shortestsqdistance) 96 96 { 97 97 shortestsqdistance = sqdistance; 98 this->target_ = (*it);98 this->target_ = pawn; 99 99 } 100 100 } -
code/branches/cpp11_v2/src/orxonox/gamestates/GSLevel.cc
r10916 r10919 164 164 // Note: Temporarily moved to GSRoot. 165 165 //// Call the scene objects 166 //for ( ObjectList<Tickable>::iterator it = ObjectList<Tickable>::begin(); it; ++it)167 // it->tick(time.getDeltaTime() * this->timeFactor_);166 //for (Tickable* tickable : ObjectList<Tickable>()) 167 // tickable->tick(time.getDeltaTime() * this->timeFactor_); 168 168 } 169 169 170 170 void GSLevel::prepareObjectTracking() 171 171 { 172 for ( ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it != ObjectList<BaseObject>::end(); ++it)173 this->staticObjects_.insert( *it);172 for (BaseObject* baseObject : ObjectList<BaseObject>()) 173 this->staticObjects_.insert(baseObject); 174 174 } 175 175 … … 178 178 orxout(internal_info) << "Remaining objects:" << endl; 179 179 unsigned int i = 0; 180 for ( ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it != ObjectList<BaseObject>::end(); ++it)181 { 182 std::set<BaseObject*>::const_iterator find = this->staticObjects_.find( *it);180 for (BaseObject* baseObject : ObjectList<BaseObject>()) 181 { 182 std::set<BaseObject*>::const_iterator find = this->staticObjects_.find(baseObject); 183 183 if (find == this->staticObjects_.end()) 184 184 { 185 orxout(internal_warning) << ++i << ": " << it->getIdentifier()->getName() << " (" << *it << "), references: " << it->getReferenceCount() << endl;185 orxout(internal_warning) << ++i << ": " << baseObject->getIdentifier()->getName() << " (" << baseObject << "), references: " << baseObject->getReferenceCount() << endl; 186 186 } 187 187 } … … 235 235 // export all states 236 236 std::vector<GSLevelMementoState*> states; 237 for ( ObjectList<GSLevelMemento>::iterator it = ObjectList<GSLevelMemento>::begin(); it != ObjectList<GSLevelMemento>::end(); ++it)238 { 239 GSLevelMementoState* state = it->exportMementoState();237 for (GSLevelMemento* memento : ObjectList<GSLevelMemento>()) 238 { 239 GSLevelMementoState* state = memento->exportMementoState(); 240 240 if (state) 241 241 states.push_back(state); … … 247 247 248 248 // import all states 249 for ( ObjectList<GSLevelMemento>::iterator it = ObjectList<GSLevelMemento>::begin(); it != ObjectList<GSLevelMemento>::end(); ++it)250 it->importMementoState(states);249 for (GSLevelMemento* memento : ObjectList<GSLevelMemento>()) 250 memento->importMementoState(states); 251 251 252 252 // delete states -
code/branches/cpp11_v2/src/orxonox/gamestates/GSRoot.cc
r10818 r10919 74 74 { 75 75 unsigned int nr=0; 76 for ( ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it; ++it)77 { 78 Synchronisable* synchronisable = orxonox_cast<Synchronisable*>( *it);76 for (BaseObject* baseObject : ObjectList<BaseObject>()) 77 { 78 Synchronisable* synchronisable = orxonox_cast<Synchronisable*>(baseObject); 79 79 if (synchronisable) 80 orxout(debug_output) << "object: " << it->getIdentifier()->getName() << " id: " << synchronisable->getObjectID() << endl;80 orxout(debug_output) << "object: " << baseObject->getIdentifier()->getName() << " id: " << synchronisable->getObjectID() << endl; 81 81 else 82 orxout(debug_output) << "object: " << it->getIdentifier()->getName() << endl;82 orxout(debug_output) << "object: " << baseObject->getIdentifier()->getName() << endl; 83 83 nr++; 84 84 } -
code/branches/cpp11_v2/src/orxonox/gametypes/Gametype.cc
r10917 r10919 571 571 // find correct scene 572 572 Scene* scene = nullptr; 573 for ( ObjectList<Scene>::iterator it = ObjectList<Scene>::begin(); it != ObjectList<Scene>::end(); ++it)574 { 575 if ( it->getName() == state->sceneName_)576 { 577 scene = *it;573 for (Scene* someScene : ObjectList<Scene>()) 574 { 575 if (someScene->getName() == state->sceneName_) 576 { 577 scene = someScene; 578 578 break; 579 579 } -
code/branches/cpp11_v2/src/orxonox/gametypes/Mission.cc
r10624 r10919 101 101 void Mission::setTeams() 102 102 { //Set pawn-colours 103 for ( ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)103 for (Pawn* pawn : ObjectList<Pawn>()) 104 104 { 105 Pawn* pawn = static_cast<Pawn*>(*it);106 105 if (!pawn) 107 106 continue; … … 111 110 void Mission::endMission(bool accomplished) 112 111 { 113 for ( ObjectList<Mission>::iterator it = ObjectList<Mission>::begin(); it != ObjectList<Mission>::end(); ++it)112 for (Mission* mission : ObjectList<Mission>()) 114 113 { //TODO: make sure that only the desired mission is ended !! This is a dirty HACK, that would end ALL missions! 115 it->setMissionAccomplished(accomplished);116 it->end();114 mission->setMissionAccomplished(accomplished); 115 mission->end(); 117 116 } 118 117 } … … 120 119 void Mission::setLivesWrapper(unsigned int amount) 121 120 { 122 for ( ObjectList<Mission>::iterator it = ObjectList<Mission>::begin(); it != ObjectList<Mission>::end(); ++it)121 for (Mission* mission : ObjectList<Mission>()) 123 122 { //TODO: make sure that only the desired mission is ended !! This is a dirty HACK, that would affect ALL missions! 124 it->setLives(amount);123 mission->setLives(amount); 125 124 } 126 125 } -
code/branches/cpp11_v2/src/orxonox/infos/GametypeInfo.cc
r10624 r10919 461 461 void GametypeInfo::dispatchAnnounceMessage(const std::string& message) const 462 462 { 463 for ( ObjectList<GametypeMessageListener>::iterator it = ObjectList<GametypeMessageListener>::begin(); it != ObjectList<GametypeMessageListener>::end(); ++it)464 it->announcemessage(this, message);463 for (GametypeMessageListener* listener : ObjectList<GametypeMessageListener>()) 464 listener->announcemessage(this, message); 465 465 } 466 466 467 467 void GametypeInfo::dispatchKillMessage(const std::string& message) const 468 468 { 469 for ( ObjectList<GametypeMessageListener>::iterator it = ObjectList<GametypeMessageListener>::begin(); it != ObjectList<GametypeMessageListener>::end(); ++it)470 it->killmessage(this, message);469 for (GametypeMessageListener* listener : ObjectList<GametypeMessageListener>()) 470 listener->killmessage(this, message); 471 471 } 472 472 473 473 void GametypeInfo::dispatchDeathMessage(const std::string& message) const 474 474 { 475 for ( ObjectList<GametypeMessageListener>::iterator it = ObjectList<GametypeMessageListener>::begin(); it != ObjectList<GametypeMessageListener>::end(); ++it)476 it->deathmessage(this, message);475 for (GametypeMessageListener* listener : ObjectList<GametypeMessageListener>()) 476 listener->deathmessage(this, message); 477 477 } 478 478 479 479 void GametypeInfo::dispatchStaticMessage(const std::string& message, const ColourValue& colour) const 480 480 { 481 for ( ObjectList<GametypeMessageListener>::iterator it = ObjectList<GametypeMessageListener>::begin(); it != ObjectList<GametypeMessageListener>::end(); ++it)482 it->staticmessage(this, message, colour);481 for (GametypeMessageListener* listener : ObjectList<GametypeMessageListener>()) 482 listener->staticmessage(this, message, colour); 483 483 } 484 484 485 485 void GametypeInfo::dispatchFadingMessage(const std::string& message) const 486 486 { 487 for ( ObjectList<GametypeMessageListener>::iterator it = ObjectList<GametypeMessageListener>::begin(); it != ObjectList<GametypeMessageListener>::end(); ++it)488 it->fadingmessage(this, message);487 for (GametypeMessageListener* listener : ObjectList<GametypeMessageListener>()) 488 listener->fadingmessage(this, message); 489 489 } 490 490 } -
code/branches/cpp11_v2/src/orxonox/interfaces/NotificationListener.cc
r10624 r10919 108 108 { 109 109 // Iterate through all NotificationListeners and notify them by calling the method they overloaded. 110 for( ObjectList<NotificationListener>::iterator it = ObjectList<NotificationListener>::begin(); it != ObjectList<NotificationListener>::end(); ++it)110 for(NotificationListener* listener : ObjectList<NotificationListener>()) 111 111 { 112 112 // If the notification is a message. 113 113 if(!isCommand) 114 it->registerNotification(message, sender, notificationMessageType::Value(messageType));114 listener->registerNotification(message, sender, notificationMessageType::Value(messageType)); 115 115 116 116 // If the notification is a command. … … 119 119 notificationCommand::Value command = str2Command(message); 120 120 if(command != notificationCommand::none) 121 it->executeCommand(command, sender);121 listener->executeCommand(command, sender); 122 122 } 123 123 } -
code/branches/cpp11_v2/src/orxonox/interfaces/PickupCarrier.cc
r10916 r10919 101 101 // Go recursively through all children to check whether they are a target. 102 102 std::vector<PickupCarrier*>* children = this->getCarrierChildren(); 103 for( std::vector<PickupCarrier*>::const_iterator it = children->begin(); it != children->end(); it++)103 for(PickupCarrier* carrier : *children) 104 104 { 105 if( (*it)->isTarget(pickup))105 if(carrier->isTarget(pickup)) 106 106 { 107 107 isTarget = true; -
code/branches/cpp11_v2/src/orxonox/interfaces/PickupListener.cc
r10624 r10919 74 74 75 75 // Iterate through all PickupListeners and notify them by calling the method they overloaded. 76 for( ObjectList<PickupListener>::iterator it = ObjectList<PickupListener>::begin(); it != ObjectList<PickupListener>::end(); ++it)77 it->pickupChangedUsed(pickup, used);76 for(PickupListener* listener : ObjectList<PickupListener>()) 77 listener->pickupChangedUsed(pickup, used); 78 78 } 79 79 … … 92 92 93 93 // Iterate through all PickupListeners and notify them by calling the method they overloaded. 94 for( ObjectList<PickupListener>::iterator it = ObjectList<PickupListener>::begin(); it != ObjectList<PickupListener>::end(); ++it)95 it->pickupChangedPickedUp(pickup, pickedUp);94 for(PickupListener* listener : ObjectList<PickupListener>()) 95 listener->pickupChangedPickedUp(pickup, pickedUp); 96 96 } 97 97 -
code/branches/cpp11_v2/src/orxonox/items/MultiStateEngine.cc
r10916 r10919 85 85 { 86 86 // We have no ship, so the effects are not attached and won't be destroyed automatically 87 for ( std::vector<EffectContainer*>::const_iterator it = this->effectContainers_.begin(); it != this->effectContainers_.end(); ++it)88 for (std::vector<WorldEntity*>::const_iterator it 2 = (*it)->getEffectsBegin(); it2 != (*it)->getEffectsBegin(); ++it2)89 (*it 2)->destroy();87 for (EffectContainer* container : this->effectContainers_) 88 for (std::vector<WorldEntity*>::const_iterator it = container->getEffectsBegin(); it != container->getEffectsBegin(); ++it) 89 (*it)->destroy(); 90 90 if (this->defEngineSndNormal_) 91 91 this->defEngineSndNormal_->destroy(); … … 178 178 179 179 // Update all effect conditions 180 for ( std::vector<EffectContainer*>::const_iterator it = this->effectContainers_.begin(); it != this->effectContainers_.end(); ++it)181 (*it)->updateCondition();180 for (EffectContainer* container : this->effectContainers_) 181 container->updateCondition(); 182 182 } 183 183 } … … 198 198 this->getShip()->attach(defEngineSndBoost_); 199 199 200 for ( std::vector<EffectContainer*>::const_iterator it = this->effectContainers_.begin(); it != this->effectContainers_.end(); ++it)201 for (std::vector<WorldEntity*>::const_iterator it 2 = (*it)->getEffectsBegin(); it2 != (*it)->getEffectsEnd(); ++it2)202 this->getShip()->attach(*it 2);200 for (EffectContainer* container : this->effectContainers_) 201 for (std::vector<WorldEntity*>::const_iterator it = container->getEffectsBegin(); it != container->getEffectsEnd(); ++it) 202 this->getShip()->attach(*it); 203 203 } 204 204 -
code/branches/cpp11_v2/src/orxonox/overlays/OverlayGroup.cc
r10916 r10919 170 170 /*static*/ void OverlayGroup::toggleVisibility(const std::string& name) 171 171 { 172 for (O bjectList<OverlayGroup>::iterator it = ObjectList<OverlayGroup>::begin(); it; ++it)173 { 174 if ( (*it)->getName() == name)175 (*it)->setVisible(!((*it)->isVisible()));172 for (OverlayGroup* group : ObjectList<OverlayGroup>()) 173 { 174 if (group->getName() == name) 175 group->setVisible(!(group->isVisible())); 176 176 } 177 177 } … … 185 185 /*static*/ void OverlayGroup::show(const std::string& name) 186 186 { 187 for (O bjectList<OverlayGroup>::iterator it = ObjectList<OverlayGroup>::begin(); it; ++it)188 { 189 if ( (*it)->getName() == name)187 for (OverlayGroup* group : ObjectList<OverlayGroup>()) 188 { 189 if (group->getName() == name) 190 190 { 191 if( (*it)->isVisible())192 (*it)->changedVisibility();191 if(group->isVisible()) 192 group->changedVisibility(); 193 193 else 194 (*it)->setVisible(!((*it)->isVisible()));194 group->setVisible(!(group->isVisible())); 195 195 } 196 196 } … … 208 208 /*static*/ void OverlayGroup::scaleGroup(const std::string& name, float scale) 209 209 { 210 for (O bjectList<OverlayGroup>::iterator it = ObjectList<OverlayGroup>::begin(); it; ++it)211 { 212 if ( (*it)->getName() == name)213 (*it)->scale(Vector2(scale, scale));210 for (OverlayGroup* group : ObjectList<OverlayGroup>()) 211 { 212 if (group->getName() == name) 213 group->scale(Vector2(scale, scale)); 214 214 } 215 215 } … … 226 226 /*static*/ void OverlayGroup::scrollGroup(const std::string& name, const Vector2& scroll) 227 227 { 228 for (O bjectList<OverlayGroup>::iterator it = ObjectList<OverlayGroup>::begin(); it; ++it)229 { 230 if ( (*it)->getName() == name)231 (*it)->scroll(scroll);228 for (OverlayGroup* group : ObjectList<OverlayGroup>()) 229 { 230 if (group->getName() == name) 231 group->scroll(scroll); 232 232 } 233 233 } -
code/branches/cpp11_v2/src/orxonox/sound/SoundManager.cc
r10918 r10919 294 294 { 295 295 case SoundType::All: 296 for ( ObjectList<BaseSound>::iterator it = ObjectList<BaseSound>::begin(); it != ObjectList<BaseSound>::end(); ++it)297 (*it)->updateVolume();296 for (BaseSound* sound : ObjectList<BaseSound>()) 297 sound->updateVolume(); 298 298 break; 299 299 case SoundType::Music: 300 for ( ObjectList<AmbientSound>::iterator it = ObjectList<AmbientSound>::begin(); it != ObjectList<AmbientSound>::end(); ++it)301 (*it)->updateVolume();300 for (AmbientSound* sound : ObjectList<AmbientSound>()) 301 sound->updateVolume(); 302 302 break; 303 303 case SoundType::Effects: 304 for ( ObjectList<WorldSound>::iterator it = ObjectList<WorldSound>::begin(); it != ObjectList<WorldSound>::end(); ++it)305 (*it)->updateVolume();304 for (WorldSound* sound : ObjectList<WorldSound>()) 305 sound->updateVolume(); 306 306 break; 307 307 default: -
code/branches/cpp11_v2/src/orxonox/sound/WorldAmbientSound.cc
r10918 r10919 114 114 115 115 //HACK: Assuption - there is only one WorldAmbientSound in a level and only one level is used. 116 for (ObjectList<WorldAmbientSound>::iterator it = ObjectList<WorldAmbientSound>::begin(); 117 it != ObjectList<WorldAmbientSound>::end(); ++it) 116 for (WorldAmbientSound* sound : ObjectList<WorldAmbientSound>()) 118 117 { 119 while( it->ambientSound_->setAmbientSource(WorldAmbientSound::soundList_[WorldAmbientSound::soundNumber_]) == false){118 while(sound->ambientSound_->setAmbientSource(WorldAmbientSound::soundList_[WorldAmbientSound::soundNumber_]) == false){ 120 119 WorldAmbientSound::soundNumber_ = (WorldAmbientSound::soundNumber_ + 1) % WorldAmbientSound::soundList_.size(); 121 120 } -
code/branches/cpp11_v2/src/orxonox/weaponsystem/WeaponPack.cc
r10916 r10919 153 153 void WeaponPack::notifyWeapons() 154 154 { 155 for ( std::vector<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)156 (*it)->setWeaponPack(this);155 for (Weapon* weapon : this->weapons_) 156 weapon->setWeaponPack(this); 157 157 } 158 158 } -
code/branches/cpp11_v2/src/orxonox/worldentities/ControllableEntity.cc
r10916 r10919 108 108 this->camera_->destroy(); 109 109 110 for ( std::list<StrongPtr<CameraPosition>>::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)111 (*it)->destroy();110 for (CameraPosition* cameraPosition : this->cameraPositions_) 111 cameraPosition->destroy(); 112 112 113 113 if (this->getScene()->getSceneManager()) -
code/branches/cpp11_v2/src/orxonox/worldentities/EffectContainer.cc
r10916 r10919 103 103 bool result = (bool)lua_toboolean(this->lua_->getInternalLuaState(), -1); 104 104 lua_pop(this->lua_->getInternalLuaState(), 1); 105 for ( std::vector<WorldEntity*>::const_iterator it = this->effects_.begin(); it != this->effects_.end(); ++it)105 for (WorldEntity* effect : this->effects_) 106 106 { 107 (*it)->setMainState(result);107 effect->setMainState(result); 108 108 } 109 109 } -
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.