Index: code/branches/cpp11_v3/src/orxonox/gametypes/TeamGametype.cc
===================================================================
--- code/branches/cpp11_v3/src/orxonox/gametypes/TeamGametype.cc	(revision 11053)
+++ code/branches/cpp11_v3/src/orxonox/gametypes/TeamGametype.cc	(revision 11054)
@@ -75,5 +75,5 @@
     void TeamGametype::playerEntered(PlayerInfo* player)
     {
-        if(player == NULL) return; // catch null pointers
+        if(player == nullptr) return; // catch null pointers
         Gametype::playerEntered(player);
         this->findAndSetTeam(player);
@@ -96,10 +96,10 @@
     void TeamGametype::findAndSetTeam(PlayerInfo* player)
     {
-        if(player == NULL) return; // catch null pointers
+        if(player == nullptr) return; // catch null pointers
         std::vector<unsigned int> playersperteam(this->teams_, 0);
 
-        for (std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it)
-            if (it->second < static_cast<int>(this->teams_) && it->second >= 0)
-                playersperteam[it->second]++;
+        for (const auto& mapEntry : this->teamnumbers_)
+            if (mapEntry.second < static_cast<int>(this->teams_) && mapEntry.second >= 0)
+                playersperteam[mapEntry.second]++;
 
         unsigned int minplayers = static_cast<unsigned int>(-1);
@@ -123,8 +123,8 @@
         if( (this->players_.size() >= maxPlayers_) && (allowedInGame_[player] == true) ) // if there's a "waiting list"
         {
-            for (std::map<PlayerInfo*, bool>::iterator it = this->allowedInGame_.begin(); it != this->allowedInGame_.end(); ++it)
-            {
-                 if(it->second == false) // waiting player found
-                 {it->second = true; break;} // allow player to enter
+            for (auto& mapEntry : this->allowedInGame_)
+            {
+                 if(mapEntry.second == false) // waiting player found
+                 {mapEntry.second = true; break;} // allow player to enter
             }
         }
@@ -141,15 +141,15 @@
     void TeamGametype::spawnDeadPlayersIfRequested()
     {
-        for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)\
-        {
-            if(allowedInGame_[it->first] == false)//check if dead player is allowed to enter
+        for (const auto& mapEntry : this->players_)\
+        {
+            if(allowedInGame_[mapEntry.first] == false)//check if dead player is allowed to enter
             {
                 continue;
             }
-            if (it->second.state_ == PlayerState::Dead)
-            {
-                if ((it->first->isReadyToSpawn() || this->bForceSpawn_))
+            if (mapEntry.second.state_ == PlayerState::Dead)
+            {
+                if ((mapEntry.first->isReadyToSpawn() || this->bForceSpawn_))
                 {
-                   this->spawnPlayer(it->first);
+                   this->spawnPlayer(mapEntry.first);
                 }
             }
@@ -178,9 +178,9 @@
         if(!player || this->getTeam(player) == -1)
             return 0;
-        for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
-        {
-            if ( this->getTeam(it->first) ==  this->getTeam(player) )
-            {
-                teamscore += it->second.frags_;
+        for (const auto& mapEntry : this->players_)
+        {
+            if ( this->getTeam(mapEntry.first) ==  this->getTeam(player) )
+            {
+                teamscore += mapEntry.second.frags_;
             }
         }
@@ -191,7 +191,7 @@
     {
         int teamSize = 0;
-        for (std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it)
-        {
-            if (it->second == team)
+        for (const auto& mapEntry : this->teamnumbers_)
+        {
+            if (mapEntry.second == team)
                 teamSize++;
         }
@@ -202,7 +202,7 @@
     {
         int teamSize = 0;
-        for (std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it)
-        {
-            if (it->second == team  && it->first->isHumanPlayer())
+        for (const auto& mapEntry : this->teamnumbers_)
+        {
+            if (mapEntry.second == team  && mapEntry.first->isHumanPlayer())
                 teamSize++;
         }
@@ -235,5 +235,5 @@
         }
 
-        SpawnPoint* fallbackSpawnPoint = NULL;
+        SpawnPoint* fallbackSpawnPoint = nullptr;
         if (teamSpawnPoints.size() > 0)
         {
@@ -241,9 +241,9 @@
             unsigned int index = 0;
             // Get random fallback spawnpoint in case there is no active SpawnPoint.
-            for (std::set<SpawnPoint*>::const_iterator it = teamSpawnPoints.begin(); it != teamSpawnPoints.end(); ++it)
+            for (SpawnPoint* teamSpawnPoint : teamSpawnPoints)
             {
                 if (index == randomspawn)
                 {
-                    fallbackSpawnPoint = (*it);
+                    fallbackSpawnPoint = teamSpawnPoint;
                     break;
                 }
@@ -266,8 +266,8 @@
             randomspawn = static_cast<unsigned int>(rnd(static_cast<float>(teamSpawnPoints.size())));
             index = 0;
-            for (std::set<SpawnPoint*>::const_iterator it = teamSpawnPoints.begin(); it != teamSpawnPoints.end(); ++it)
+            for (SpawnPoint* teamSpawnPoint : teamSpawnPoints)
             {
                 if (index == randomspawn)
-                    return (*it);
+                    return teamSpawnPoint;
 
                 ++index;
@@ -277,5 +277,5 @@
         }
 
-        return 0;
+        return nullptr;
     }
 
@@ -328,5 +328,5 @@
     void TeamGametype::setDefaultObjectColour(Pawn* pawn)
     {
-        if(pawn == NULL)
+        if(pawn == nullptr)
             return;
 
@@ -340,5 +340,5 @@
         ControllableEntity* entity = orxonox_cast<ControllableEntity*>(pawn);
 
-        Controller* controller = 0;
+        Controller* controller = nullptr;
         if (entity->getController())
             controller = entity->getController();
@@ -350,5 +350,5 @@
         ArtificialController* artificial =  orxonox_cast<ArtificialController*>(controller);
         //get Teamnumber - get the data
-        if(artificial == NULL)
+        if(artificial == nullptr)
             return;
         teamnumber= artificial->getTeam();
@@ -360,13 +360,13 @@
     void TeamGametype::colourPawn(Pawn* pawn, int teamNr)
     {// catch: no-colouring-case and wrong input
-        if(teamNr < 0 || teamNr+1 > int(this->teamcolours_.size()) ||pawn == NULL) return;
+        if(teamNr < 0 || teamNr+1 > int(this->teamcolours_.size()) ||pawn == nullptr) return;
         pawn->setRadarObjectColour(this->teamcolours_[teamNr]);
 
         std::set<WorldEntity*> pawnAttachments = pawn->getAttachedObjects();
-        for (std::set<WorldEntity*>::iterator it = pawnAttachments.begin(); it != pawnAttachments.end(); ++it)
-        {
-            if ((*it)->isA(Class(TeamColourable)))
-            {
-                TeamColourable* tc = orxonox_cast<TeamColourable*>(*it);
+        for (WorldEntity* pawnAttachment : pawnAttachments)
+        {
+            if (pawnAttachment->isA(Class(TeamColourable)))
+            {
+                TeamColourable* tc = orxonox_cast<TeamColourable*>(pawnAttachment);
                 tc->setTeamColour(this->teamcolours_[teamNr]);
             }
@@ -376,15 +376,15 @@
     void TeamGametype::announceTeamWin(int winnerTeam)
     {
-        for (std::map<PlayerInfo*, int>::iterator it3 = this->teamnumbers_.begin(); it3 != this->teamnumbers_.end(); ++it3)
-        {
-            if (it3->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
+        for (const auto& mapEntry : this->teamnumbers_)
+        {
+            if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
                 continue;
-            if (it3->second == winnerTeam)
-            {
-                this->gtinfo_->sendAnnounceMessage("Your team has won the match!", it3->first->getClientID());
+            if (mapEntry.second == winnerTeam)
+            {
+                this->gtinfo_->sendAnnounceMessage("Your team has won the match!", mapEntry.first->getClientID());
             }
             else
             {
-                this->gtinfo_->sendAnnounceMessage("Your team has lost the match!", it3->first->getClientID());
+                this->gtinfo_->sendAnnounceMessage("Your team has lost the match!", mapEntry.first->getClientID());
             }
         }   
