Index: code/trunk/src/modules/gametypes/SpaceRaceController.cc
===================================================================
--- code/trunk/src/modules/gametypes/SpaceRaceController.cc	(revision 10318)
+++ code/trunk/src/modules/gametypes/SpaceRaceController.cc	(revision 11071)
@@ -59,10 +59,10 @@
 
         virtualCheckPointIndex = -2;
-        if (ObjectList<SpaceRaceManager>::size() != 1)
-            orxout(internal_warning) << "Expected 1 instance of SpaceRaceManager but found " << ObjectList<SpaceRaceManager>::size() << endl;
-        for (ObjectList<SpaceRaceManager>::iterator it = ObjectList<SpaceRaceManager>::begin(); it != ObjectList<SpaceRaceManager>::end(); ++it)
-        {
-            checkpoints = it->getAllCheckpoints();
-            nextRaceCheckpoint_ = it->findCheckpoint(0);
+        if (ObjectList<SpaceRaceManager>().size() != 1)
+            orxout(internal_warning) << "Expected 1 instance of SpaceRaceManager but found " << ObjectList<SpaceRaceManager>().size() << endl;
+        for (SpaceRaceManager* manager : ObjectList<SpaceRaceManager>())
+        {
+            checkpoints = manager->getAllCheckpoints();
+            nextRaceCheckpoint_ = manager->findCheckpoint(0);
         }
 
@@ -98,5 +98,5 @@
                     RaceCheckPoint* point2 = findCheckpoint((*numb));
 
-                    //if(point2 != NULL)
+                    //if(point2 != nullptr)
                     //placeVirtualCheckpoints((*it), point2);
                 }
@@ -126,8 +126,8 @@
         staticRacePoints_ = findStaticCheckpoints(nextRaceCheckpoint_, checkpoints);
         // initialisation of currentRaceCheckpoint_
-        currentRaceCheckpoint_ = NULL;
+        currentRaceCheckpoint_ = nullptr;
 
         int i;
-        for (i = -2; findCheckpoint(i) != NULL; i--)
+        for (i = -2; findCheckpoint(i) != nullptr; i--)
         {
             continue;
@@ -154,16 +154,16 @@
     {
         std::map<RaceCheckPoint*, int> zaehler; // counts how many times the checkpoint was reached (for simulation)
-        for (unsigned int i = 0; i < allCheckpoints.size(); i++)
-        {
-            zaehler.insert(std::pair<RaceCheckPoint*, int>(allCheckpoints[i],0));
+        for (RaceCheckPoint* checkpoint : allCheckpoints)
+        {
+            zaehler.insert(std::pair<RaceCheckPoint*, int>(checkpoint,0));
         }
         int maxWays = rekSimulationCheckpointsReached(currentCheckpoint, zaehler);
 
         std::vector<RaceCheckPoint*> returnVec;
-        for (std::map<RaceCheckPoint*, int>::iterator iter = zaehler.begin(); iter != zaehler.end(); iter++)
-        {
-            if (iter->second == maxWays)
-            {
-                returnVec.push_back(iter->first);
+        for (const auto& mapEntry : zaehler)
+        {
+            if (mapEntry.second == maxWays)
+            {
+                returnVec.push_back(mapEntry.first);
             }
         }
@@ -187,15 +187,15 @@
         {
             int numberOfWays = 0; // counts number of ways from this Point to the last point
-            for (std::set<int>::iterator it = currentCheckpoint->getNextCheckpoints().begin(); it!= currentCheckpoint->getNextCheckpoints().end(); ++it)
-            {
-                if (currentCheckpoint == findCheckpoint(*it))
+            for (int checkpointIndex : currentCheckpoint->getNextCheckpoints())
+            {
+                if (currentCheckpoint == findCheckpoint(checkpointIndex))
                 {
                     //orxout() << currentCheckpoint->getCheckpointIndex()<<endl;
                     continue;
                 }
-                if (findCheckpoint(*it) == NULL)
-                    orxout(internal_warning) << "Problematic Point: " << (*it) << endl;
+                if (findCheckpoint(checkpointIndex) == nullptr)
+                    orxout(internal_warning) << "Problematic Point: " << checkpointIndex << endl;
                 else
-                    numberOfWays += rekSimulationCheckpointsReached(findCheckpoint(*it), zaehler);
+                    numberOfWays += rekSimulationCheckpointsReached(findCheckpoint(checkpointIndex), zaehler);
             }
             zaehler[currentCheckpoint] += numberOfWays;
@@ -209,5 +209,5 @@
     float SpaceRaceController::distanceSpaceshipToCheckPoint(RaceCheckPoint* CheckPoint)
     {
-        if (this->getControllableEntity() != NULL)
+        if (this->getControllableEntity() != nullptr)
         {
             return (CheckPoint->getPosition()- this->getControllableEntity()->getPosition()).length();
@@ -223,13 +223,13 @@
     {
         float minDistance = 0;
-        RaceCheckPoint* minNextRaceCheckPoint = NULL;
+        RaceCheckPoint* minNextRaceCheckPoint = nullptr;
 
         // find the next checkpoint with the minimal distance
-        for (std::set<int>::iterator it = raceCheckpoint->getNextCheckpoints().begin(); it != raceCheckpoint->getNextCheckpoints().end(); ++it)
-        {
-            RaceCheckPoint* nextRaceCheckPoint = findCheckpoint(*it);
+        for (int checkpointIndex : raceCheckpoint->getNextCheckpoints())
+        {
+            RaceCheckPoint* nextRaceCheckPoint = findCheckpoint(checkpointIndex);
             float distance = recCalculateDistance(nextRaceCheckPoint, this->getControllableEntity()->getPosition());
 
-            if (distance < minDistance || minNextRaceCheckPoint == NULL)
+            if (distance < minDistance || minNextRaceCheckPoint == nullptr)
             {
                 minDistance = distance;
@@ -255,9 +255,9 @@
         {
             float minimum = std::numeric_limits<float>::max();
-            for (std::set<int>::iterator it = currentCheckPoint->getNextCheckpoints().begin(); it != currentCheckPoint->getNextCheckpoints().end(); ++it)
+            for (int checkpointIndex : currentCheckPoint->getNextCheckpoints())
             {
                 int dist_currentCheckPoint_currentPosition = static_cast<int> ((currentPosition- currentCheckPoint->getPosition()).length());
 
-                minimum = std::min(minimum, dist_currentCheckPoint_currentPosition + recCalculateDistance(findCheckpoint(*it), currentCheckPoint->getPosition()));
+                minimum = std::min(minimum, dist_currentCheckPoint_currentPosition + recCalculateDistance(findCheckpoint(checkpointIndex), currentCheckPoint->getPosition()));
                 // minimum of distanz from 'currentPosition' to the next static Checkpoint
             }
@@ -271,5 +271,5 @@
     RaceCheckPoint* SpaceRaceController::adjustNextPoint()
     {
-        if (currentRaceCheckpoint_ == NULL) // no Adjust possible
+        if (currentRaceCheckpoint_ == nullptr) // no Adjust possible
 
         {
@@ -289,8 +289,8 @@
     RaceCheckPoint* SpaceRaceController::findCheckpoint(int index) const
     {
-        for (size_t i = 0; i < this->checkpoints_.size(); ++i)
-            if (this->checkpoints_[i]->getCheckpointIndex() == index)
-                return this->checkpoints_[i];
-        return NULL;
+        for (RaceCheckPoint* checkpoint : this->checkpoints_)
+            if (checkpoint->getCheckpointIndex() == index)
+                return checkpoint;
+        return nullptr;
     }
 
@@ -299,5 +299,6 @@
         orxout()<<"add VCP at"<<virtualCheckPointPosition.x<<", "<<virtualCheckPointPosition.y<<", "<<virtualCheckPointPosition.z<<endl;
         RaceCheckPoint* newTempRaceCheckPoint;
-        for (ObjectList<SpaceRaceManager>::iterator it = ObjectList<SpaceRaceManager>::begin(); it!= ObjectList<SpaceRaceManager>::end(); ++it)
+        ObjectList<SpaceRaceManager> list;
+        for (ObjectList<SpaceRaceManager>::iterator it = list.begin(); it!= list.end(); ++it)
         {
             newTempRaceCheckPoint = new RaceCheckPoint((*it));
@@ -347,5 +348,5 @@
     void SpaceRaceController::tick(float dt)
     {
-        if (this->getControllableEntity() == NULL || this->getControllableEntity()->getPlayer() == NULL )
+        if (this->getControllableEntity() == nullptr || this->getControllableEntity()->getPlayer() == nullptr )
         {
             //orxout()<< this->getControllableEntity() << " in tick"<<endl;
@@ -414,10 +415,10 @@
         btScalar radiusObject;
 
-        for (std::vector<StaticEntity*>::const_iterator it = allObjects.begin(); it != allObjects.end(); ++it)
-        {
-            for (int everyShape=0; (*it)->getAttachedCollisionShape(everyShape) != 0; everyShape++)
-            {
-                btCollisionShape* currentShape = (*it)->getAttachedCollisionShape(everyShape)->getCollisionShape();
-                if(currentShape == NULL)
+        for (StaticEntity* object : allObjects)
+        {
+            for (int everyShape=0; object->getAttachedCollisionShape(everyShape) != nullptr; everyShape++)
+            {
+                btCollisionShape* currentShape = object->getAttachedCollisionShape(everyShape)->getCollisionShape();
+                if(currentShape == nullptr)
                 continue;
 
@@ -444,8 +445,8 @@
         for (std::vector<StaticEntity*>::iterator it = allObjects.begin(); it != allObjects.end(); ++it)
         {
-            for (int everyShape=0; (*it)->getAttachedCollisionShape(everyShape) != 0; everyShape++)
+            for (int everyShape=0; (*it)->getAttachedCollisionShape(everyShape) != nullptr; everyShape++)
             {
                 btCollisionShape* currentShape = (*it)->getAttachedCollisionShape(everyShape)->getCollisionShape();
-                if(currentShape == NULL)
+                if(currentShape == nullptr)
                 continue;
 
@@ -488,8 +489,9 @@
         std::vector<StaticEntity*> problematicObjects;
 
-        for (ObjectList<StaticEntity>::iterator it = ObjectList<StaticEntity>::begin(); it!= ObjectList<StaticEntity>::end(); ++it)
-        {
-
-            if (dynamic_cast<RaceCheckPoint*>(*it) != NULL)
+        ObjectList<StaticEntity> list;
+        for (ObjectList<StaticEntity>::iterator it = list.begin(); it!= list.end(); ++it)
+        {
+
+            if (dynamic_cast<RaceCheckPoint*>(*it) != nullptr)
             {
                 continue;
@@ -537,10 +539,10 @@
         //                    btVector3 positionObject;
         //                    btScalar radiusObject;
-        //                    if((*it)==NULL)
+        //                    if((*it)==nullptr)
         //                    {   orxout()<<"Problempoint 1.1"<<endl; continue;}
         //                    //TODO: Probably it points on a wrong object
-        //                    for (int everyShape=0; (*it)->getAttachedCollisionShape(everyShape)!=0; everyShape++)
+        //                    for (int everyShape=0; (*it)->getAttachedCollisionShape(everyShape)!=nullptr; everyShape++)
         //                    {
-        //                        if((*it)->getAttachedCollisionShape(everyShape)->getCollisionShape()==NULL)
+        //                        if((*it)->getAttachedCollisionShape(everyShape)->getCollisionShape()==nullptr)
         //                        {    continue;}
         //
@@ -570,9 +572,9 @@
         //                        btVector3 positionObject;
         //                        btScalar radiusObject;
-        //                        if((*it)==NULL)
+        //                        if((*it)==nullptr)
         //                        {   orxout()<<"Problempoint 1"<<endl; continue;}
-        //                        for (int everyShape=0; (*it)->getAttachedCollisionShape(everyShape)!=0; everyShape++)
+        //                        for (int everyShape=0; (*it)->getAttachedCollisionShape(everyShape)!=nullptr; everyShape++)
         //                        {
-        //                            if((*it)->getAttachedCollisionShape(everyShape)->getCollisionShape()==NULL)
+        //                            if((*it)->getAttachedCollisionShape(everyShape)->getCollisionShape()==nullptr)
         //                            {   orxout()<<"Problempoint 2.2"<<endl; continue;}
         //                            (*it)->getAttachedCollisionShape(everyShape)->getCollisionShape()->getBoundingSphere(positionObject,radiusObject);
