Index: code/branches/cpp11_v2/src/orxonox/gametypes/Gametype.cc
===================================================================
--- code/branches/cpp11_v2/src/orxonox/gametypes/Gametype.cc	(revision 10768)
+++ code/branches/cpp11_v2/src/orxonox/gametypes/Gametype.cc	(revision 10821)
@@ -139,9 +139,9 @@
         if (!this->gtinfo_->hasStarted())
         {
-            for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
+            for (auto & elem : this->players_)
             {
                 // Inform the GametypeInfo that the player is ready to spawn.
-                if(it->first->isHumanPlayer() && it->first->isReadyToSpawn())
-                    this->gtinfo_->playerReadyToSpawn(it->first);
+                if(elem.first->isHumanPlayer() && elem.first->isReadyToSpawn())
+                    this->gtinfo_->playerReadyToSpawn(elem.first);
             }
 
@@ -169,9 +169,9 @@
         }
 
-        for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
-        {
-            if (it->first->getControllableEntity())
-            {
-                ControllableEntity* oldentity = it->first->getControllableEntity();
+        for (auto & elem : this->players_)
+        {
+            if (elem.first->getControllableEntity())
+            {
+                ControllableEntity* oldentity = elem.first->getControllableEntity();
 
                 ControllableEntity* entity = this->defaultControllableEntity_.fabricate(oldentity->getContext());
@@ -186,8 +186,8 @@
                     entity->setOrientation(oldentity->getWorldOrientation());
                 }
-                it->first->startControl(entity);
+                elem.first->startControl(entity);
             }
             else
-                this->spawnPlayerAsDefaultPawn(it->first);
+                this->spawnPlayerAsDefaultPawn(elem.first);
         }
     }
@@ -341,11 +341,11 @@
             unsigned int index = 0;
             std::vector<SpawnPoint*> activeSpawnPoints;
-            for (std::set<SpawnPoint*>::const_iterator it = this->spawnpoints_.begin(); it != this->spawnpoints_.end(); ++it)
+            for (const auto & elem : this->spawnpoints_)
             {
                 if (index == randomspawn)
-                    fallbackSpawnPoint = (*it);
-
-                if (*it != nullptr && (*it)->isActive())
-                    activeSpawnPoints.push_back(*it);
+                    fallbackSpawnPoint = (elem);
+
+                if (elem != nullptr && (elem)->isActive())
+                    activeSpawnPoints.push_back(elem);
 
                 ++index;
@@ -366,14 +366,14 @@
     void Gametype::assignDefaultPawnsIfNeeded()
     {
-        for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
-        {
-            if (!it->first->getControllableEntity())
-            {
-                it->second.state_ = PlayerState::Dead;
-
-                if (!it->first->isReadyToSpawn() || !this->gtinfo_->hasStarted())
-                {
-                    this->spawnPlayerAsDefaultPawn(it->first);
-                    it->second.state_ = PlayerState::Dead;
+        for (auto & elem : this->players_)
+        {
+            if (!elem.first->getControllableEntity())
+            {
+                elem.second.state_ = PlayerState::Dead;
+
+                if (!elem.first->isReadyToSpawn() || !this->gtinfo_->hasStarted())
+                {
+                    this->spawnPlayerAsDefaultPawn(elem.first);
+                    elem.second.state_ = PlayerState::Dead;
                 }
             }
@@ -404,9 +404,9 @@
                     bool allplayersready = true;
                     bool hashumanplayers = false;
-                    for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
+                    for (auto & elem : this->players_)
                     {
-                        if (!it->first->isReadyToSpawn())
+                        if (!elem.first->isReadyToSpawn())
                             allplayersready = false;
-                        if (it->first->isHumanPlayer())
+                        if (elem.first->isHumanPlayer())
                             hashumanplayers = true;
                     }
@@ -430,8 +430,8 @@
     void Gametype::spawnPlayersIfRequested()
     {
-        for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
-        {
-            if (it->first->isReadyToSpawn() || this->bForceSpawn_)
-                this->spawnPlayer(it->first);
+        for (auto & elem : this->players_)
+        {
+            if (elem.first->isReadyToSpawn() || this->bForceSpawn_)
+                this->spawnPlayer(elem.first);
         }
     }
@@ -439,8 +439,8 @@
     void Gametype::spawnDeadPlayersIfRequested()
     {
-        for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
-            if (it->second.state_ == PlayerState::Dead)
-                if (it->first->isReadyToSpawn() || this->bForceSpawn_)
-                    this->spawnPlayer(it->first);
+        for (auto & elem : this->players_)
+            if (elem.second.state_ == PlayerState::Dead)
+                if (elem.first->isReadyToSpawn() || this->bForceSpawn_)
+                    this->spawnPlayer(elem.first);
     }
 
@@ -538,9 +538,9 @@
     GSLevelMementoState* Gametype::exportMementoState()
     {
-        for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
-        {
-            if (it->first->isHumanPlayer() && it->first->getControllableEntity() && it->first->getControllableEntity()->getCamera())
-            {
-                Camera* camera = it->first->getControllableEntity()->getCamera();
+        for (auto & elem : this->players_)
+        {
+            if (elem.first->isHumanPlayer() && elem.first->getControllableEntity() && elem.first->getControllableEntity()->getCamera())
+            {
+                Camera* camera = elem.first->getControllableEntity()->getCamera();
 
                 GametypeMementoState* state = new GametypeMementoState();
@@ -559,7 +559,7 @@
         // find correct memento state
         GametypeMementoState* state = nullptr;
-        for (size_t i = 0; i < states.size(); ++i)
-        {
-            state = dynamic_cast<GametypeMementoState*>(states[i]);
+        for (auto & states_i : states)
+        {
+            state = dynamic_cast<GametypeMementoState*>(states_i);
             if (state)
                 break;
@@ -587,12 +587,12 @@
 
         // find correct player and assign default entity with original position & orientation
-        for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
-        {
-            if (it->first->isHumanPlayer())
+        for (auto & elem : this->players_)
+        {
+            if (elem.first->isHumanPlayer())
             {
                 ControllableEntity* entity = this->defaultControllableEntity_.fabricate(scene->getContext());
                 entity->setPosition(state->cameraPosition_);
                 entity->setOrientation(state->cameraOrientation_);
-                it->first->startControl(entity);
+                elem.first->startControl(entity);
                 break;
             }
