Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 5, 2015, 10:47:51 PM (9 years ago)
Author:
landauf
Message:

use range-based for-loop where it makes sense (e.g. ObjectList)

Location:
code/branches/cpp11_v2/src/orxonox
Files:
28 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v2/src/orxonox/LevelManager.cc

    r10916 r10919  
    7878    {
    7979        // 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;
    8382    }
    8483
     
    279278
    280279                // 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();
    284283
    285284                // We don't need the loaded stuff anymore
  • code/branches/cpp11_v2/src/orxonox/MoodManager.cc

    r10624 r10919  
    103103    /*static*/ void MoodListener::changedMood(const std::string& mood)
    104104    {
    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);
    107107    }
    108108}
  • code/branches/cpp11_v2/src/orxonox/PlayerManager.cc

    r10768 r10919  
    111111        else
    112112        {
    113             for (ObjectList<PlayerInfo>::iterator it = ObjectList<PlayerInfo>::begin(); it != ObjectList<PlayerInfo>::end(); ++it)
    114                 if (it->getClientID() == clientID)
    115                     return (*it);
     113            for (PlayerInfo* info : ObjectList<PlayerInfo>())
     114                if (info->getClientID() == clientID)
     115                    return info;
    116116        }
    117117        return nullptr;
  • code/branches/cpp11_v2/src/orxonox/Radar.cc

    r10768 r10919  
    8484        this->radarObjects_.insert(rv);
    8585        // 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);
    8989        }
    9090    }
     
    9595        this->radarObjects_.erase(rv);
    9696        // 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);
    100100        }
    101101    }
     
    130130        }
    131131
    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);
    135135        }
    136136    }
     
    200200        // iterate through all Radar Objects
    201201        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;
    205206        }
    206207    }
     
    208209    void Radar::radarObjectChanged(RadarViewable* rv)
    209210    {
    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);
    213214        }
    214215    }
  • code/branches/cpp11_v2/src/orxonox/Scene.cc

    r10916 r10919  
    389389    /*static*/ void Scene::consoleCommand_debugDrawPhysics(bool bDraw, bool bFill, float fillAlpha)
    390390    {
    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);
    393393    }
    394394}
  • code/branches/cpp11_v2/src/orxonox/chat/ChatHistory.cc

    r10818 r10919  
    160160  void ChatHistory::debug_printhist()
    161161  {
    162     /* create deque iterator */
    163     std::deque<std::string>::iterator it;
    164 
    165162    /* 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;
    169165
    170166    /* output size */
  • code/branches/cpp11_v2/src/orxonox/collisionshapes/CompoundCollisionShape.cc

    r10917 r10919  
    200200        bool bEmpty = true; // Whether the CompoundCollisionShape is empty.
    201201        // 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_)
    203203        {
    204204            // TODO: Make sure this is correct.
    205             if (it->second)
     205            if (mapEntry.second)
    206206            {
    207207                bEmpty = false;
    208                 if (!it->first->hasTransform() && bPrimitive)
    209                     primitive = it->second;
     208                if (!mapEntry.first->hasTransform() && bPrimitive)
     209                    primitive = mapEntry.second;
    210210                else
    211211                {
  • code/branches/cpp11_v2/src/orxonox/controllers/FormationController.cc

    r10916 r10919  
    9797            this->removeFromFormation();
    9898
    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)
    102102                {
    103                     if (it->myMaster_ == this)
     103                    if (controller->myMaster_ == this)
    104104                    {
    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;
    107107                    }
    108108
    109109                    while (true)
    110110                    {
    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())
    113113                        {
    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);
    116116                        }
    117117                        else
     
    140140    void FormationController::formationflight(const bool form)
    141141    {
    142         for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)
     142        for (Pawn* pawn : ObjectList<Pawn>())
    143143        {
    144144            Controller* controller = nullptr;
    145145
    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();
    150150
    151151            if (!controller)
     
    171171    void FormationController::masteraction(const int action)
    172172    {
    173         for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)
     173        for (Pawn* pawn : ObjectList<Pawn>())
    174174        {
    175175            Controller* controller = nullptr;
    176176
    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();
    181181
    182182            if (!controller)
     
    201201    void FormationController::passivebehaviour(const bool passive)
    202202    {
    203         for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)
     203        for (Pawn* pawn : ObjectList<Pawn>())
    204204        {
    205205            Controller* controller = nullptr;
    206206
    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();
    211211
    212212            if (!controller)
     
    228228    void FormationController::formationsize(const int size)
    229229    {
    230         for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)
     230        for (Pawn* pawn : ObjectList<Pawn>())
    231231        {
    232232            Controller* controller = nullptr;
    233233
    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();
    238238
    239239            if (!controller)
     
    398398        int teamSize = 0;
    399399        //go through all pawns
    400         for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)
     400        for (Pawn* pawn : ObjectList<Pawn>())
    401401        {
    402402
     
    405405            if (!gt)
    406406            {
    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))
    410410                continue;
    411411
     
    413413            Controller* controller = nullptr;
    414414
    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();
    419419
    420420            if (!controller)
     
    422422
    423423            //is pawn oneself?
    424             if (orxonox_cast<ControllableEntity*>(*it) == this->getControllableEntity())
     424            if (orxonox_cast<ControllableEntity*>(pawn) == this->getControllableEntity())
    425425                continue;
    426426
     
    433433                continue;
    434434
    435             float distance = (it->getPosition() - this->getControllableEntity()->getPosition()).length();
     435            float distance = (pawn->getPosition() - this->getControllableEntity()->getPosition()).length();
    436436
    437437            // is pawn in range?
     
    520520            newMaster->myMaster_ = nullptr;
    521521
    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;
    525525            }
    526526        }
     
    549549                newMaster->myMaster_ = nullptr;
    550550
    551                 for(std::vector<FormationController*>::iterator it = newMaster->slaves_.begin(); it != newMaster->slaves_.end(); it++)
     551                for(FormationController* slave : newMaster->slaves_)
    552552                {
    553                     (*it)->myMaster_ = newMaster;
     553                    slave->myMaster_ = newMaster;
    554554                }
    555555            }
     
    777777        std::vector<FormationController*> allMasters;
    778778
    779         for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)
     779        for (Pawn* pawn : ObjectList<Pawn>())
    780780        {
    781781            Controller* controller = nullptr;
    782782
    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();
    787787
    788788            if (!controller)
     
    791791            currentHumanController = orxonox_cast<NewHumanController*>(controller);
    792792
    793             if(currentHumanController) humanPawn = *it;
     793            if(currentHumanController) humanPawn = pawn;
    794794
    795795            FormationController *aiController = orxonox_cast<FormationController*>(controller);
     
    808808            int i = 0;
    809809
    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();
    814814                if(distance < minDistance) index = i;
     815                i++;
    815816            }
    816817            allMasters[index]->followInit(humanPawn);
     
    847848        NewHumanController *currentHumanController = nullptr;
    848849
    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());
    855856            if(currentHumanController)
    856857            {
    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;
    859860                break;
    860861            }
     
    918919        this->forgetTarget();
    919920
    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()))
    923924                continue;
    924925
    925926            /* 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())
    930931            {
    931932                float speed = this->getControllableEntity()->getVelocity().length();
    932933                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)
    935936                        < this->targetPosition_.squaredDistance(this->getControllableEntity()->getPosition()) * (1.5f + acos((this->getControllableEntity()->getOrientation() * WorldEntity::FRONT).dotProduct(distanceCurrent) / speed / distanceCurrent.length()) / math::twoPi) + rnd(-250, 250))
    936937                {
    937                     this->setTarget(*it);
     938                    this->setTarget(pawn);
    938939                }
    939940            }
  • code/branches/cpp11_v2/src/orxonox/controllers/ScriptController.cc

    r10765 r10919  
    121121
    122122      /* 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; }
    127125
    128126      /* 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>())
    132128      {
    133129        // 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;
    137133        }
    138134     
  • code/branches/cpp11_v2/src/orxonox/controllers/WaypointPatrolController.cc

    r10768 r10919  
    8787        float shortestsqdistance = (float)static_cast<unsigned int>(-1);
    8888
    89         for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)
     89        for (Pawn* pawn : ObjectList<Pawn>())
    9090        {
    91             if (ArtificialController::sameTeam(this->getControllableEntity(), static_cast<ControllableEntity*>(*it), this->getGametype()))
     91            if (ArtificialController::sameTeam(this->getControllableEntity(), static_cast<ControllableEntity*>(pawn), this->getGametype()))
    9292                continue;
    9393
    94             float sqdistance = it->getPosition().squaredDistance(myposition);
     94            float sqdistance = pawn->getPosition().squaredDistance(myposition);
    9595            if (sqdistance < shortestsqdistance)
    9696            {
    9797                shortestsqdistance = sqdistance;
    98                 this->target_ = (*it);
     98                this->target_ = pawn;
    9999            }
    100100        }
  • code/branches/cpp11_v2/src/orxonox/gamestates/GSLevel.cc

    r10916 r10919  
    164164        // Note: Temporarily moved to GSRoot.
    165165        //// 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_);
    168168    }
    169169
    170170    void GSLevel::prepareObjectTracking()
    171171    {
    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);
    174174    }
    175175
     
    178178        orxout(internal_info) << "Remaining objects:" << endl;
    179179        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);
    183183            if (find == this->staticObjects_.end())
    184184            {
    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;
    186186            }
    187187        }
     
    235235        // export all states
    236236        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();
    240240            if (state)
    241241                states.push_back(state);
     
    247247
    248248        // 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);
    251251
    252252        // delete states
  • code/branches/cpp11_v2/src/orxonox/gamestates/GSRoot.cc

    r10818 r10919  
    7474    {
    7575        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);
    7979            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;
    8181            else
    82                 orxout(debug_output) << "object: " << it->getIdentifier()->getName() << endl;
     82                orxout(debug_output) << "object: " << baseObject->getIdentifier()->getName() << endl;
    8383            nr++;
    8484        }
  • code/branches/cpp11_v2/src/orxonox/gametypes/Gametype.cc

    r10917 r10919  
    571571        // find correct scene
    572572        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;
    578578                break;
    579579            }
  • code/branches/cpp11_v2/src/orxonox/gametypes/Mission.cc

    r10624 r10919  
    101101    void Mission::setTeams()
    102102    { //Set pawn-colours
    103         for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)
     103        for (Pawn* pawn : ObjectList<Pawn>())
    104104        {
    105             Pawn* pawn = static_cast<Pawn*>(*it);
    106105            if (!pawn)
    107106                continue;
     
    111110    void Mission::endMission(bool accomplished)
    112111    {
    113         for (ObjectList<Mission>::iterator it = ObjectList<Mission>::begin(); it != ObjectList<Mission>::end(); ++it)
     112        for (Mission* mission : ObjectList<Mission>())
    114113        { //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();
    117116        }
    118117    }
     
    120119    void Mission::setLivesWrapper(unsigned int amount)
    121120    {
    122         for (ObjectList<Mission>::iterator it = ObjectList<Mission>::begin(); it != ObjectList<Mission>::end(); ++it)
     121        for (Mission* mission : ObjectList<Mission>())
    123122        { //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);
    125124        }
    126125    }
  • code/branches/cpp11_v2/src/orxonox/infos/GametypeInfo.cc

    r10624 r10919  
    461461    void GametypeInfo::dispatchAnnounceMessage(const std::string& message) const
    462462    {
    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);
    465465    }
    466466
    467467    void GametypeInfo::dispatchKillMessage(const std::string& message) const
    468468    {
    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);
    471471    }
    472472
    473473    void GametypeInfo::dispatchDeathMessage(const std::string& message) const
    474474    {
    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);
    477477    }
    478478
    479479     void GametypeInfo::dispatchStaticMessage(const std::string& message, const ColourValue& colour) const
    480480    {
    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);
    483483    }
    484484
    485485     void GametypeInfo::dispatchFadingMessage(const std::string& message) const
    486486    {
    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);
    489489    }
    490490}
  • code/branches/cpp11_v2/src/orxonox/interfaces/NotificationListener.cc

    r10624 r10919  
    108108    {
    109109        // 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>())
    111111        {
    112112            // If the notification is a message.
    113113            if(!isCommand)
    114                 it->registerNotification(message, sender, notificationMessageType::Value(messageType));
     114                listener->registerNotification(message, sender, notificationMessageType::Value(messageType));
    115115
    116116            // If the notification is a command.
     
    119119                notificationCommand::Value command = str2Command(message);
    120120                if(command != notificationCommand::none)
    121                     it->executeCommand(command, sender);
     121                    listener->executeCommand(command, sender);
    122122            }
    123123        }
  • code/branches/cpp11_v2/src/orxonox/interfaces/PickupCarrier.cc

    r10916 r10919  
    101101        // Go recursively through all children to check whether they are a target.
    102102        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)
    104104        {
    105             if((*it)->isTarget(pickup))
     105            if(carrier->isTarget(pickup))
    106106            {
    107107                isTarget = true;
  • code/branches/cpp11_v2/src/orxonox/interfaces/PickupListener.cc

    r10624 r10919  
    7474
    7575        // 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);
    7878    }
    7979
     
    9292
    9393        // 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);
    9696    }
    9797
  • code/branches/cpp11_v2/src/orxonox/items/MultiStateEngine.cc

    r10916 r10919  
    8585            {
    8686                // 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 it2 = (*it)->getEffectsBegin(); it2 != (*it)->getEffectsBegin(); ++it2)
    89                         (*it2)->destroy();
     87                for (EffectContainer* container : this->effectContainers_)
     88                    for (std::vector<WorldEntity*>::const_iterator it = container->getEffectsBegin(); it != container->getEffectsBegin(); ++it)
     89                        (*it)->destroy();
    9090                if (this->defEngineSndNormal_)
    9191                    this->defEngineSndNormal_->destroy();
     
    178178
    179179                // 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();
    182182            }
    183183        }
     
    198198            this->getShip()->attach(defEngineSndBoost_);
    199199
    200         for (std::vector<EffectContainer*>::const_iterator it = this->effectContainers_.begin(); it != this->effectContainers_.end(); ++it)
    201             for (std::vector<WorldEntity*>::const_iterator it2 = (*it)->getEffectsBegin(); it2 != (*it)->getEffectsEnd(); ++it2)
    202                 this->getShip()->attach(*it2);
     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);
    203203    }
    204204
  • code/branches/cpp11_v2/src/orxonox/overlays/OverlayGroup.cc

    r10916 r10919  
    170170    /*static*/ void OverlayGroup::toggleVisibility(const std::string& name)
    171171    {
    172         for (ObjectList<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()));
    176176        }
    177177    }
     
    185185    /*static*/ void OverlayGroup::show(const std::string& name)
    186186    {
    187         for (ObjectList<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)
    190190            {
    191                 if((*it)->isVisible())
    192                     (*it)->changedVisibility();
     191                if(group->isVisible())
     192                    group->changedVisibility();
    193193                else
    194                     (*it)->setVisible(!((*it)->isVisible()));
     194                    group->setVisible(!(group->isVisible()));
    195195            }
    196196        }
     
    208208    /*static*/ void OverlayGroup::scaleGroup(const std::string& name, float scale)
    209209    {
    210         for (ObjectList<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));
    214214        }
    215215    }
     
    226226    /*static*/ void OverlayGroup::scrollGroup(const std::string& name, const Vector2& scroll)
    227227    {
    228         for (ObjectList<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);
    232232        }
    233233    }
  • code/branches/cpp11_v2/src/orxonox/sound/SoundManager.cc

    r10918 r10919  
    294294        {
    295295        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();
    298298            break;
    299299        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();
    302302            break;
    303303        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();
    306306            break;
    307307        default:
  • code/branches/cpp11_v2/src/orxonox/sound/WorldAmbientSound.cc

    r10918 r10919  
    114114
    115115        //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>())
    118117        {
    119             while(it->ambientSound_->setAmbientSource(WorldAmbientSound::soundList_[WorldAmbientSound::soundNumber_]) == false){
     118            while(sound->ambientSound_->setAmbientSource(WorldAmbientSound::soundList_[WorldAmbientSound::soundNumber_]) == false){
    120119                WorldAmbientSound::soundNumber_ = (WorldAmbientSound::soundNumber_ + 1) % WorldAmbientSound::soundList_.size();
    121120            }
  • code/branches/cpp11_v2/src/orxonox/weaponsystem/WeaponPack.cc

    r10916 r10919  
    153153    void WeaponPack::notifyWeapons()
    154154    {
    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);
    157157    }
    158158}
  • code/branches/cpp11_v2/src/orxonox/worldentities/ControllableEntity.cc

    r10916 r10919  
    108108                this->camera_->destroy();
    109109
    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();
    112112
    113113            if (this->getScene()->getSceneManager())
  • code/branches/cpp11_v2/src/orxonox/worldentities/EffectContainer.cc

    r10916 r10919  
    103103            bool result = (bool)lua_toboolean(this->lua_->getInternalLuaState(), -1);
    104104            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_)
    106106            {
    107                 (*it)->setMainState(result);
     107                effect->setMainState(result);
    108108            }
    109109        }
  • code/branches/cpp11_v2/src/orxonox/worldentities/pawns/ModularSpaceShip.cc

    r10916 r10919  
    174174    void ModularSpaceShip::killShipPartStatic(std::string name)
    175175    {
    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();
    181181                return;
    182182            }
     
    193193    void ModularSpaceShip::killShipPart(std::string name)
    194194    {
    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();
    200200                return;
    201201            }
  • code/branches/cpp11_v2/src/orxonox/worldentities/pawns/Pawn.cc

    r10768 r10919  
    574574    bool Pawn::hasSlaves()
    575575    {
    576         for (ObjectList<FormationController>::iterator it =
    577              ObjectList<FormationController>::begin();
    578              it != ObjectList<FormationController>::end(); ++it )
     576        for (FormationController* controller : ObjectList<FormationController>())
    579577        {
    580578            // 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())
    582580                return true;
    583581        }
     
    587585    // A function that returns a slave of the pawn's controller
    588586    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();
    595591        }
    596592        return nullptr;
  • code/branches/cpp11_v2/src/orxonox/worldentities/pawns/TeamBaseMatchBase.cc

    r10916 r10919  
    9292
    9393        // 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);
    9696    }
    9797}
Note: See TracChangeset for help on using the changeset viewer.