[Orxonox-commit 6260] r10917 - in code/branches/cpp11_v2/src: libraries/core libraries/core/class libraries/core/input libraries/core/module modules/gametypes modules/mini4dgame modules/notifications modules/overlays/hud modules/pickup modules/pong modules/questsystem modules/tetris orxonox/collisionshapes orxonox/controllers orxonox/gametypes orxonox/weaponsystem

landauf at orxonox.net landauf at orxonox.net
Wed Dec 2 23:32:08 CET 2015


Author: landauf
Date: 2015-12-02 23:32:08 +0100 (Wed, 02 Dec 2015)
New Revision: 10917

Modified:
   code/branches/cpp11_v2/src/libraries/core/Language.cc
   code/branches/cpp11_v2/src/libraries/core/Loader.cc
   code/branches/cpp11_v2/src/libraries/core/NamespaceNode.cc
   code/branches/cpp11_v2/src/libraries/core/class/Identifier.cc
   code/branches/cpp11_v2/src/libraries/core/input/InputManager.cc
   code/branches/cpp11_v2/src/libraries/core/module/DynLibManager.cc
   code/branches/cpp11_v2/src/libraries/core/module/ModuleInstance.cc
   code/branches/cpp11_v2/src/libraries/core/module/PluginManager.cc
   code/branches/cpp11_v2/src/modules/gametypes/SpaceRaceController.cc
   code/branches/cpp11_v2/src/modules/gametypes/SpaceRaceManager.cc
   code/branches/cpp11_v2/src/modules/mini4dgame/Mini4Dgame.cc
   code/branches/cpp11_v2/src/modules/notifications/NotificationManager.cc
   code/branches/cpp11_v2/src/modules/notifications/NotificationQueue.cc
   code/branches/cpp11_v2/src/modules/overlays/hud/HUDNavigation.cc
   code/branches/cpp11_v2/src/modules/overlays/hud/HUDRadar.cc
   code/branches/cpp11_v2/src/modules/pickup/PickupManager.cc
   code/branches/cpp11_v2/src/modules/pong/Pong.cc
   code/branches/cpp11_v2/src/modules/questsystem/QuestManager.cc
   code/branches/cpp11_v2/src/modules/tetris/Tetris.cc
   code/branches/cpp11_v2/src/orxonox/collisionshapes/CompoundCollisionShape.cc
   code/branches/cpp11_v2/src/orxonox/controllers/ArtificialController.cc
   code/branches/cpp11_v2/src/orxonox/gametypes/Dynamicmatch.cc
   code/branches/cpp11_v2/src/orxonox/gametypes/Gametype.cc
   code/branches/cpp11_v2/src/orxonox/gametypes/LastManStanding.cc
   code/branches/cpp11_v2/src/orxonox/gametypes/LastTeamStanding.cc
   code/branches/cpp11_v2/src/orxonox/gametypes/TeamBaseMatch.cc
   code/branches/cpp11_v2/src/orxonox/gametypes/TeamDeathmatch.cc
   code/branches/cpp11_v2/src/orxonox/gametypes/TeamGametype.cc
   code/branches/cpp11_v2/src/orxonox/gametypes/UnderAttack.cc
   code/branches/cpp11_v2/src/orxonox/weaponsystem/Munition.cc
   code/branches/cpp11_v2/src/orxonox/weaponsystem/Weapon.cc
   code/branches/cpp11_v2/src/orxonox/weaponsystem/WeaponSet.cc
   code/branches/cpp11_v2/src/orxonox/weaponsystem/WeaponSystem.cc
Log:
made mapEntry const& wherever possible

Modified: code/branches/cpp11_v2/src/libraries/core/Language.cc
===================================================================
--- code/branches/cpp11_v2/src/libraries/core/Language.cc	2015-12-02 22:22:03 UTC (rev 10916)
+++ code/branches/cpp11_v2/src/libraries/core/Language.cc	2015-12-02 22:32:08 UTC (rev 10917)
@@ -106,7 +106,7 @@
     */
     Language::~Language()
     {
-        for (auto& mapEntry : this->languageEntries_)
+        for (const auto& mapEntry : this->languageEntries_)
             delete (mapEntry.second);
     }
 

Modified: code/branches/cpp11_v2/src/libraries/core/Loader.cc
===================================================================
--- code/branches/cpp11_v2/src/libraries/core/Loader.cc	2015-12-02 22:22:03 UTC (rev 10916)
+++ code/branches/cpp11_v2/src/libraries/core/Loader.cc	2015-12-02 22:32:08 UTC (rev 10917)
@@ -260,7 +260,7 @@
         // check whether on every opening <?lua tag a closing ?> tag follows
         {
             bool expectedValue = true;
-            for (auto& mapEntry : luaTags)
+            for (const auto& mapEntry : luaTags)
             {
                 if (mapEntry.second == expectedValue)
                     expectedValue = !expectedValue;

Modified: code/branches/cpp11_v2/src/libraries/core/NamespaceNode.cc
===================================================================
--- code/branches/cpp11_v2/src/libraries/core/NamespaceNode.cc	2015-12-02 22:22:03 UTC (rev 10916)
+++ code/branches/cpp11_v2/src/libraries/core/NamespaceNode.cc	2015-12-02 22:32:08 UTC (rev 10917)
@@ -102,7 +102,7 @@
             {
                 bool bFoundMatchingNamespace = false;
 
-                for (auto& mapEntry : this->subnodes_)
+                for (const auto& mapEntry : this->subnodes_)
                 {
                     if (mapEntry.first.find(firstPart) == (mapEntry.first.size() - firstPart.size()))
                     {

Modified: code/branches/cpp11_v2/src/libraries/core/class/Identifier.cc
===================================================================
--- code/branches/cpp11_v2/src/libraries/core/class/Identifier.cc	2015-12-02 22:22:03 UTC (rev 10916)
+++ code/branches/cpp11_v2/src/libraries/core/class/Identifier.cc	2015-12-02 22:32:08 UTC (rev 10917)
@@ -91,11 +91,11 @@
         for (const Identifier* directChild : this->directChildren_)
             const_cast<Identifier*>(directChild)->directParents_.remove(this);
 
-        for (auto& mapEntry : this->configValues_)
+        for (const auto& mapEntry : this->configValues_)
             delete (mapEntry.second);
-        for (auto& mapEntry : this->xmlportParamContainers_)
+        for (const auto& mapEntry : this->xmlportParamContainers_)
             delete (mapEntry.second);
-        for (auto& mapEntry : this->xmlportObjectContainers_)
+        for (const auto& mapEntry : this->xmlportObjectContainers_)
             delete (mapEntry.second);
     }
 

Modified: code/branches/cpp11_v2/src/libraries/core/input/InputManager.cc
===================================================================
--- code/branches/cpp11_v2/src/libraries/core/input/InputManager.cc	2015-12-02 22:22:03 UTC (rev 10916)
+++ code/branches/cpp11_v2/src/libraries/core/input/InputManager.cc	2015-12-02 22:32:08 UTC (rev 10917)
@@ -372,7 +372,7 @@
 
         // check whether a state has changed its EMPTY situation
         bool bUpdateRequired = false;
-        for (auto& mapEntry : activeStates_)
+        for (const auto& mapEntry : activeStates_)
         {
             if (mapEntry.second->hasExpired())
             {

Modified: code/branches/cpp11_v2/src/libraries/core/module/DynLibManager.cc
===================================================================
--- code/branches/cpp11_v2/src/libraries/core/module/DynLibManager.cc	2015-12-02 22:22:03 UTC (rev 10916)
+++ code/branches/cpp11_v2/src/libraries/core/module/DynLibManager.cc	2015-12-02 22:32:08 UTC (rev 10917)
@@ -74,7 +74,7 @@
     DynLibManager::~DynLibManager()
     {
         // Unload & delete resources in turn
-        for (auto& mapEntry : mLibList)
+        for (const auto& mapEntry : mLibList)
         {
             mapEntry.second->unload();
             delete mapEntry.second;

Modified: code/branches/cpp11_v2/src/libraries/core/module/ModuleInstance.cc
===================================================================
--- code/branches/cpp11_v2/src/libraries/core/module/ModuleInstance.cc	2015-12-02 22:22:03 UTC (rev 10916)
+++ code/branches/cpp11_v2/src/libraries/core/module/ModuleInstance.cc	2015-12-02 22:32:08 UTC (rev 10917)
@@ -74,7 +74,7 @@
     {
         std::map<StaticInitialization::Type, std::set<StaticallyInitializedInstance*>> copy(this->staticallyInitializedInstancesByType_);
         this->staticallyInitializedInstancesByType_.clear();
-        for (auto& mapEntry : copy)
+        for (const auto& mapEntry : copy)
             for (std::set<StaticallyInitializedInstance*>::iterator it2 = mapEntry.second.begin(); it2 != mapEntry.second.end(); ++it2)
                 delete (*it2);
     }

Modified: code/branches/cpp11_v2/src/libraries/core/module/PluginManager.cc
===================================================================
--- code/branches/cpp11_v2/src/libraries/core/module/PluginManager.cc	2015-12-02 22:22:03 UTC (rev 10916)
+++ code/branches/cpp11_v2/src/libraries/core/module/PluginManager.cc	2015-12-02 22:32:08 UTC (rev 10917)
@@ -58,9 +58,9 @@
         ModifyConsoleCommand("PluginManager", __CC_PluginManager_load_name).setObject(nullptr);
         ModifyConsoleCommand("PluginManager", __CC_PluginManager_unload_name).setObject(nullptr);
 
-        for (auto& mapEntry : this->references_)
+        for (const auto& mapEntry : this->references_)
             delete mapEntry.second;
-        for (auto& mapEntry : this->plugins_)
+        for (const auto& mapEntry : this->plugins_)
             delete mapEntry.second;
     }
 

Modified: code/branches/cpp11_v2/src/modules/gametypes/SpaceRaceController.cc
===================================================================
--- code/branches/cpp11_v2/src/modules/gametypes/SpaceRaceController.cc	2015-12-02 22:22:03 UTC (rev 10916)
+++ code/branches/cpp11_v2/src/modules/gametypes/SpaceRaceController.cc	2015-12-02 22:32:08 UTC (rev 10917)
@@ -160,7 +160,7 @@
         int maxWays = rekSimulationCheckpointsReached(currentCheckpoint, zaehler);
 
         std::vector<RaceCheckPoint*> returnVec;
-        for (auto& mapEntry : zaehler)
+        for (const auto& mapEntry : zaehler)
         {
             if (mapEntry.second == maxWays)
             {

Modified: code/branches/cpp11_v2/src/modules/gametypes/SpaceRaceManager.cc
===================================================================
--- code/branches/cpp11_v2/src/modules/gametypes/SpaceRaceManager.cc	2015-12-02 22:22:03 UTC (rev 10916)
+++ code/branches/cpp11_v2/src/modules/gametypes/SpaceRaceManager.cc	2015-12-02 22:32:08 UTC (rev 10917)
@@ -76,7 +76,7 @@
             this->firstcheckpointvisible_ = true;
         }
 
-        for (auto& mapEntry : players_)
+        for (const auto& mapEntry : players_)
         {
 
             for (RaceCheckPoint* checkpoint : this->checkpoints_)

Modified: code/branches/cpp11_v2/src/modules/mini4dgame/Mini4Dgame.cc
===================================================================
--- code/branches/cpp11_v2/src/modules/mini4dgame/Mini4Dgame.cc	2015-12-02 22:22:03 UTC (rev 10916)
+++ code/branches/cpp11_v2/src/modules/mini4dgame/Mini4Dgame.cc	2015-12-02 22:32:08 UTC (rev 10917)
@@ -154,11 +154,11 @@
     void Mini4Dgame::spawnPlayersIfRequested()
     {
         // first spawn human players to assign always the left bat to the player in singleplayer
-        for (auto& mapEntry : this->players_)
+        for (const auto& mapEntry : this->players_)
             if (mapEntry.first->isHumanPlayer() && (mapEntry.first->isReadyToSpawn() || this->bForceSpawn_))
                 this->spawnPlayer(mapEntry.first);
         // now spawn bots
-        for (auto& mapEntry : this->players_)
+        for (const auto& mapEntry : this->players_)
             if (!mapEntry.first->isHumanPlayer() && (mapEntry.first->isReadyToSpawn() || this->bForceSpawn_))
                 this->spawnPlayer(mapEntry.first);
     }

Modified: code/branches/cpp11_v2/src/modules/notifications/NotificationManager.cc
===================================================================
--- code/branches/cpp11_v2/src/modules/notifications/NotificationManager.cc	2015-12-02 22:22:03 UTC (rev 10916)
+++ code/branches/cpp11_v2/src/modules/notifications/NotificationManager.cc	2015-12-02 22:32:08 UTC (rev 10917)
@@ -68,7 +68,7 @@
     NotificationManager::~NotificationManager()
     {
         // Destroys all Notifications.
-        for(auto& mapEntry : this->allNotificationsList_)
+        for(const auto& mapEntry : this->allNotificationsList_)
             mapEntry.second->destroy();
         this->allNotificationsList_.clear();
 
@@ -151,7 +151,7 @@
         bool all = (sender == NotificationListener::ALL);
         bool executed = false;
         // Clear all NotificationQueues that have the input sender as target.
-        for(auto& mapEntry : this->queues_) // Iterate through all NotificationQueues.
+        for(const auto& mapEntry : this->queues_) // Iterate through all NotificationQueues.
         {
             const std::set<std::string>& set = mapEntry.second->getTargetsSet();
             // If either the sender is 'all', the NotificationQueue has as target all or the NotificationQueue has the input sender as a target.
@@ -186,7 +186,7 @@
         bool all = (notification->getSender() == NotificationListener::ALL);
 
         // Insert the Notification in all NotificationQueues that have its sender as target.
-        for(auto& mapEntry : this->queues_) // Iterate through all NotificationQueues.
+        for(const auto& mapEntry : this->queues_) // Iterate through all NotificationQueues.
         {
             const std::set<std::string>& set = mapEntry.second->getTargetsSet();
             bool bAll = set.find(NotificationListener::ALL) != set.end();
@@ -344,7 +344,7 @@
         }
 
         // Iterate through all Notifications to determine whether any of them should belong to the newly registered NotificationQueue.
-        for(auto& mapEntry : this->allNotificationsList_)
+        for(const auto& mapEntry : this->allNotificationsList_)
         {
             if(!bAll && set.find(mapEntry.second->getSender()) != set.end()) // Checks whether the listener has the sender of the current Notification as target.
                 map->insert(std::pair<std::time_t, Notification*>(mapEntry.first, mapEntry.second));

Modified: code/branches/cpp11_v2/src/modules/notifications/NotificationQueue.cc
===================================================================
--- code/branches/cpp11_v2/src/modules/notifications/NotificationQueue.cc	2015-12-02 22:22:03 UTC (rev 10916)
+++ code/branches/cpp11_v2/src/modules/notifications/NotificationQueue.cc	2015-12-02 22:32:08 UTC (rev 10917)
@@ -205,7 +205,7 @@
         if(!notifications->empty())
         {
             // Add all Notifications that have been created after this NotificationQueue was created.
-            for(auto& mapEntry : *notifications)
+            for(const auto& mapEntry : *notifications)
             {
                 if(mapEntry.first >= this->creationTime_)
                     this->push(mapEntry.second, mapEntry.first);

Modified: code/branches/cpp11_v2/src/modules/overlays/hud/HUDNavigation.cc
===================================================================
--- code/branches/cpp11_v2/src/modules/overlays/hud/HUDNavigation.cc	2015-12-02 22:22:03 UTC (rev 10916)
+++ code/branches/cpp11_v2/src/modules/overlays/hud/HUDNavigation.cc	2015-12-02 22:32:08 UTC (rev 10917)
@@ -130,7 +130,7 @@
             return;
         }
         this->fontName_ = font;
-        for (auto& mapEntry : this->activeObjectList_)
+        for (const auto& mapEntry : this->activeObjectList_)
         {
             if (mapEntry.second.text_ != nullptr)
                 mapEntry.second.text_->setFontName(this->fontName_);
@@ -150,7 +150,7 @@
             return;
         }
         this->textSize_ = size;
-        for (auto& mapEntry : this->activeObjectList_)
+        for (const auto& mapEntry : this->activeObjectList_)
         {
             if (mapEntry.second.text_)
                 mapEntry.second.text_->setCharHeight(size);
@@ -530,7 +530,7 @@
         float xScale = this->getActualSize().x;
         float yScale = this->getActualSize().y;
 
-        for (auto& mapEntry : this->activeObjectList_)
+        for (const auto& mapEntry : this->activeObjectList_)
         {
             if (mapEntry.second.health_ != nullptr)
                 mapEntry.second.health_->setDimensions(this->healthMarkerSize_ * xScale, this->healthMarkerSize_ * yScale);

Modified: code/branches/cpp11_v2/src/modules/overlays/hud/HUDRadar.cc
===================================================================
--- code/branches/cpp11_v2/src/modules/overlays/hud/HUDRadar.cc	2015-12-02 22:22:03 UTC (rev 10916)
+++ code/branches/cpp11_v2/src/modules/overlays/hud/HUDRadar.cc	2015-12-02 22:32:08 UTC (rev 10917)
@@ -91,7 +91,7 @@
             Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->map3DFront_);
             Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->map3DBack_);
 
-            for (auto& mapEntry : this->radarObjects_)
+            for (const auto& mapEntry : this->radarObjects_)
             {
                 Ogre::OverlayManager::getSingleton().destroyOverlayElement(mapEntry.second);
             }

Modified: code/branches/cpp11_v2/src/modules/pickup/PickupManager.cc
===================================================================
--- code/branches/cpp11_v2/src/modules/pickup/PickupManager.cc	2015-12-02 22:22:03 UTC (rev 10916)
+++ code/branches/cpp11_v2/src/modules/pickup/PickupManager.cc	2015-12-02 22:32:08 UTC (rev 10917)
@@ -90,7 +90,7 @@
         this->representations_.clear();
 
         // Destroying all the PickupInventoryContainers that are still there.
-        for(auto& mapEntry : this->pickupInventoryContainers_)
+        for(const auto& mapEntry : this->pickupInventoryContainers_)
             delete mapEntry.second;
         this->pickupInventoryContainers_.clear();
 

Modified: code/branches/cpp11_v2/src/modules/pong/Pong.cc
===================================================================
--- code/branches/cpp11_v2/src/modules/pong/Pong.cc	2015-12-02 22:22:03 UTC (rev 10916)
+++ code/branches/cpp11_v2/src/modules/pong/Pong.cc	2015-12-02 22:32:08 UTC (rev 10917)
@@ -210,11 +210,11 @@
     void Pong::spawnPlayersIfRequested()
     {
         // first spawn human players to assign always the left bat to the player in singleplayer
-        for (auto& mapEntry : this->players_)
+        for (const auto& mapEntry : this->players_)
             if (mapEntry.first->isHumanPlayer() && (mapEntry.first->isReadyToSpawn() || this->bForceSpawn_))
                 this->spawnPlayer(mapEntry.first);
         // now spawn bots
-        for (auto& mapEntry : this->players_)
+        for (const auto& mapEntry : this->players_)
             if (!mapEntry.first->isHumanPlayer() && (mapEntry.first->isReadyToSpawn() || this->bForceSpawn_))
                 this->spawnPlayer(mapEntry.first);
     }

Modified: code/branches/cpp11_v2/src/modules/questsystem/QuestManager.cc
===================================================================
--- code/branches/cpp11_v2/src/modules/questsystem/QuestManager.cc	2015-12-02 22:22:03 UTC (rev 10916)
+++ code/branches/cpp11_v2/src/modules/questsystem/QuestManager.cc	2015-12-02 22:32:08 UTC (rev 10917)
@@ -234,7 +234,7 @@
     int QuestManager::getNumRootQuests(PlayerInfo* player)
     {
         int numQuests = 0;
-        for(auto& mapEntry : this->questMap_)
+        for(const auto& mapEntry : this->questMap_)
         {
             if(mapEntry.second->getParentQuest() == nullptr && !mapEntry.second->isInactive(player))
                 numQuests++;
@@ -254,7 +254,7 @@
     */
     Quest* QuestManager::getRootQuest(PlayerInfo* player, int index)
     {
-        for(auto& mapEntry : this->questMap_)
+        for(const auto& mapEntry : this->questMap_)
         {
             if(mapEntry.second->getParentQuest() == nullptr && !mapEntry.second->isInactive(player) && index-- == 0)
                 return mapEntry.second;

Modified: code/branches/cpp11_v2/src/modules/tetris/Tetris.cc
===================================================================
--- code/branches/cpp11_v2/src/modules/tetris/Tetris.cc	2015-12-02 22:22:03 UTC (rev 10916)
+++ code/branches/cpp11_v2/src/modules/tetris/Tetris.cc	2015-12-02 22:32:08 UTC (rev 10917)
@@ -340,7 +340,7 @@
     void Tetris::spawnPlayersIfRequested()
     {
         // Spawn a human player.
-        for (auto& mapEntry : this->players_)
+        for (const auto& mapEntry : this->players_)
             if (mapEntry.first->isHumanPlayer() && (mapEntry.first->isReadyToSpawn() || this->bForceSpawn_))
                 this->spawnPlayer(mapEntry.first);
     }

Modified: code/branches/cpp11_v2/src/orxonox/collisionshapes/CompoundCollisionShape.cc
===================================================================
--- code/branches/cpp11_v2/src/orxonox/collisionshapes/CompoundCollisionShape.cc	2015-12-02 22:22:03 UTC (rev 10916)
+++ code/branches/cpp11_v2/src/orxonox/collisionshapes/CompoundCollisionShape.cc	2015-12-02 22:32:08 UTC (rev 10917)
@@ -64,7 +64,7 @@
         if (this->isInitialized())
         {
             // Delete all children
-            for (auto& mapEntry : this->attachedShapes_)
+            for (const auto& mapEntry : this->attachedShapes_)
             {
                 // make sure that the child doesn't want to detach itself --> speedup because of the missing update
                 mapEntry.first->notifyDetached();
@@ -265,7 +265,7 @@
 
         std::vector<CollisionShape*> shapes;
         // Iterate through all attached CollisionShapes and add them to the list of shapes.
-        for(auto& mapEntry : this->attachedShapes_)
+        for(const auto& mapEntry : this->attachedShapes_)
             shapes.push_back(mapEntry.first);
 
         // Delete the compound shape and create a new one.

Modified: code/branches/cpp11_v2/src/orxonox/controllers/ArtificialController.cc
===================================================================
--- code/branches/cpp11_v2/src/orxonox/controllers/ArtificialController.cc	2015-12-02 22:22:03 UTC (rev 10916)
+++ code/branches/cpp11_v2/src/orxonox/controllers/ArtificialController.cc	2015-12-02 22:32:08 UTC (rev 10917)
@@ -230,7 +230,7 @@
 
     int ArtificialController::getFiremode(std::string name)
     {
-        for (auto& mapEntry : this->weaponModes_)
+        for (const auto& mapEntry : this->weaponModes_)
         {
             if (mapEntry.first == name)
                 return mapEntry.second;

Modified: code/branches/cpp11_v2/src/orxonox/gametypes/Dynamicmatch.cc
===================================================================
--- code/branches/cpp11_v2/src/orxonox/gametypes/Dynamicmatch.cc	2015-12-02 22:22:03 UTC (rev 10916)
+++ code/branches/cpp11_v2/src/orxonox/gametypes/Dynamicmatch.cc	2015-12-02 22:32:08 UTC (rev 10917)
@@ -404,7 +404,7 @@
 */
     void Dynamicmatch::rewardPig()
     {
-        for (auto& mapEntry : this->playerParty_) //durch alle Spieler iterieren und alle piggys finden
+        for (const auto& mapEntry : this->playerParty_) //durch alle Spieler iterieren und alle piggys finden
         {
             if (mapEntry.second==piggy)//Spieler mit der Pig-party frags++
             {
@@ -440,7 +440,7 @@
             notEnoughPigs=true;
             if (tutorial) // Announce selectionphase
             {
-             for (auto& mapEntry : this->playerParty_)
+             for (const auto& mapEntry : this->playerParty_)
                 {
                     if (!mapEntry.first)//in order to catch nullpointer
                         continue;
@@ -455,7 +455,7 @@
              notEnoughPigs=false;
              if(tutorial&&(!notEnoughKillers)&&(!notEnoughChasers)) //Selection phase over
              {
-                  for (auto& mapEntry : this->playerParty_)
+                  for (const auto& mapEntry : this->playerParty_)
                   {
                        if (!mapEntry.first)//in order to catch nullpointer
                            continue;
@@ -489,7 +489,7 @@
             notEnoughKillers=true;
             if (tutorial) // Announce selectionphase
             {
-             for (auto& mapEntry : this->playerParty_)
+             for (const auto& mapEntry : this->playerParty_)
                 {
                     if (!mapEntry.first)//in order to catch nullpointer
                         continue;
@@ -504,7 +504,7 @@
             notEnoughKillers=false;
             if(tutorial&&(!notEnoughPigs)&&(!notEnoughChasers)) //Selection phase over
              {
-                  for (auto& mapEntry : this->playerParty_)
+                  for (const auto& mapEntry : this->playerParty_)
                   {
                        if (!mapEntry.first)
                            continue;
@@ -539,7 +539,7 @@
             notEnoughChasers=true;
             if (tutorial) // Announce selectionphase
             {
-             for (auto& mapEntry : this->playerParty_)
+             for (const auto& mapEntry : this->playerParty_)
                 {
                     if (!mapEntry.first)//in order to catch nullpointer
                         continue;
@@ -554,7 +554,7 @@
              notEnoughChasers=false;
              if(tutorial&&(!notEnoughPigs)&&(!notEnoughKillers)) //Selection phase over
              {
-                  for (auto& mapEntry : this->playerParty_)
+                  for (const auto& mapEntry : this->playerParty_)
                   {
                        if (!mapEntry.first)
                            continue;
@@ -619,7 +619,7 @@
         }
         else if(tutorial) // Announce selectionphase
         {
-            for (auto& mapEntry : this->playerParty_)
+            for (const auto& mapEntry : this->playerParty_)
             {
                 if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
                     continue;

Modified: code/branches/cpp11_v2/src/orxonox/gametypes/Gametype.cc
===================================================================
--- code/branches/cpp11_v2/src/orxonox/gametypes/Gametype.cc	2015-12-02 22:22:03 UTC (rev 10916)
+++ code/branches/cpp11_v2/src/orxonox/gametypes/Gametype.cc	2015-12-02 22:32:08 UTC (rev 10917)
@@ -138,7 +138,7 @@
 
         if (!this->gtinfo_->hasStarted())
         {
-            for (auto& mapEntry : this->players_)
+            for (const auto& mapEntry : this->players_)
             {
                 // Inform the GametypeInfo that the player is ready to spawn.
                 if(mapEntry.first->isHumanPlayer() && mapEntry.first->isReadyToSpawn())
@@ -168,7 +168,7 @@
             this->showMenuTimer_.setTimer(3.0f, true, createExecutor(createFunctor(&Gametype::showMenu, this)));
         }
 
-        for (auto& mapEntry : this->players_)
+        for (const auto& mapEntry : this->players_)
         {
             if (mapEntry.first->getControllableEntity())
             {
@@ -403,7 +403,7 @@
                 {
                     bool allplayersready = true;
                     bool hashumanplayers = false;
-                    for (auto& mapEntry : this->players_)
+                    for (const auto& mapEntry : this->players_)
                     {
                         if (!mapEntry.first->isReadyToSpawn())
                             allplayersready = false;
@@ -429,7 +429,7 @@
 
     void Gametype::spawnPlayersIfRequested()
     {
-        for (auto& mapEntry : this->players_)
+        for (const auto& mapEntry : this->players_)
         {
             if (mapEntry.first->isReadyToSpawn() || this->bForceSpawn_)
                 this->spawnPlayer(mapEntry.first);
@@ -438,7 +438,7 @@
 
     void Gametype::spawnDeadPlayersIfRequested()
     {
-        for (auto& mapEntry : this->players_)
+        for (const auto& mapEntry : this->players_)
             if (mapEntry.second.state_ == PlayerState::Dead)
                 if (mapEntry.first->isReadyToSpawn() || this->bForceSpawn_)
                     this->spawnPlayer(mapEntry.first);
@@ -537,7 +537,7 @@
 
     GSLevelMementoState* Gametype::exportMementoState()
     {
-        for (auto& mapEntry : this->players_)
+        for (const auto& mapEntry : this->players_)
         {
             if (mapEntry.first->isHumanPlayer() && mapEntry.first->getControllableEntity() && mapEntry.first->getControllableEntity()->getCamera())
             {
@@ -586,7 +586,7 @@
         }
 
         // find correct player and assign default entity with original position & orientation
-        for (auto& mapEntry : this->players_)
+        for (const auto& mapEntry : this->players_)
         {
             if (mapEntry.first->isHumanPlayer())
             {

Modified: code/branches/cpp11_v2/src/orxonox/gametypes/LastManStanding.cc
===================================================================
--- code/branches/cpp11_v2/src/orxonox/gametypes/LastManStanding.cc	2015-12-02 22:22:03 UTC (rev 10916)
+++ code/branches/cpp11_v2/src/orxonox/gametypes/LastManStanding.cc	2015-12-02 22:32:08 UTC (rev 10917)
@@ -55,7 +55,7 @@
 
     void LastManStanding::spawnDeadPlayersIfRequested()
     {
-        for (auto& mapEntry : this->players_)
+        for (const auto& mapEntry : this->players_)
             if (mapEntry.second.state_ == PlayerState::Dead)
             {
                 bool alive = (0<playerLives_[mapEntry.first]&&(inGame_[mapEntry.first]));
@@ -113,7 +113,7 @@
     int LastManStanding::getMinLives()
     {
         int min=lives;
-        for (auto& mapEntry : this->playerLives_)
+        for (const auto& mapEntry : this->playerLives_)
         {
             if (mapEntry.second<=0)
                 continue;
@@ -127,7 +127,7 @@
     {
         Gametype::end();
 
-        for (auto& mapEntry : this->playerLives_)
+        for (const auto& mapEntry : this->playerLives_)
         {
             if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
                 continue;

Modified: code/branches/cpp11_v2/src/orxonox/gametypes/LastTeamStanding.cc
===================================================================
--- code/branches/cpp11_v2/src/orxonox/gametypes/LastTeamStanding.cc	2015-12-02 22:22:03 UTC (rev 10916)
+++ code/branches/cpp11_v2/src/orxonox/gametypes/LastTeamStanding.cc	2015-12-02 22:32:08 UTC (rev 10917)
@@ -144,7 +144,7 @@
 
     void LastTeamStanding::spawnDeadPlayersIfRequested()
     {
-        for (auto& mapEntry : this->players_)
+        for (const auto& mapEntry : this->players_)
             if (mapEntry.second.state_ == PlayerState::Dead)
             {
                 bool alive = (0 < playerLives_[mapEntry.first]&&(inGame_[mapEntry.first]));
@@ -228,7 +228,7 @@
         Gametype::end();
         int party = -1;
         //find a player who survived
-        for (auto& mapEntry : this->playerLives_)
+        for (const auto& mapEntry : this->playerLives_)
         {
           if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
                 continue;
@@ -254,7 +254,7 @@
     int LastTeamStanding::getMinLives()
     {
         int min = lives;
-        for (auto& mapEntry : this->playerLives_)
+        for (const auto& mapEntry : this->playerLives_)
         {
             if (mapEntry.second <= 0)
                 continue;

Modified: code/branches/cpp11_v2/src/orxonox/gametypes/TeamBaseMatch.cc
===================================================================
--- code/branches/cpp11_v2/src/orxonox/gametypes/TeamBaseMatch.cc	2015-12-02 22:22:03 UTC (rev 10916)
+++ code/branches/cpp11_v2/src/orxonox/gametypes/TeamBaseMatch.cc	2015-12-02 22:32:08 UTC (rev 10917)
@@ -186,7 +186,7 @@
                 winningteam = 1;
             }
 
-            for (auto& mapEntry : this->teamnumbers_)
+            for (const auto& mapEntry : this->teamnumbers_)
             {
                 if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
                     continue;

Modified: code/branches/cpp11_v2/src/orxonox/gametypes/TeamDeathmatch.cc
===================================================================
--- code/branches/cpp11_v2/src/orxonox/gametypes/TeamDeathmatch.cc	2015-12-02 22:22:03 UTC (rev 10916)
+++ code/branches/cpp11_v2/src/orxonox/gametypes/TeamDeathmatch.cc	2015-12-02 22:32:08 UTC (rev 10917)
@@ -68,7 +68,7 @@
         //find team that won the match
         int winnerTeam = 0;
         int highestScore = 0;
-        for (auto& mapEntry : this->players_)
+        for (const auto& mapEntry : this->players_)
         {
             if ( this->getTeamScore(mapEntry.first) > highestScore )
             {

Modified: code/branches/cpp11_v2/src/orxonox/gametypes/TeamGametype.cc
===================================================================
--- code/branches/cpp11_v2/src/orxonox/gametypes/TeamGametype.cc	2015-12-02 22:22:03 UTC (rev 10916)
+++ code/branches/cpp11_v2/src/orxonox/gametypes/TeamGametype.cc	2015-12-02 22:32:08 UTC (rev 10917)
@@ -98,7 +98,7 @@
         if(player == nullptr) return; // catch null pointers
         std::vector<unsigned int> playersperteam(this->teams_, 0);
 
-        for (auto& mapEntry : this->teamnumbers_)
+        for (const auto& mapEntry : this->teamnumbers_)
             if (mapEntry.second < static_cast<int>(this->teams_) && mapEntry.second >= 0)
                 playersperteam[mapEntry.second]++;
 
@@ -140,7 +140,7 @@
 
     void TeamGametype::spawnDeadPlayersIfRequested()
     {
-        for (auto& mapEntry : this->players_)\
+        for (const auto& mapEntry : this->players_)\
         {
             if(allowedInGame_[mapEntry.first] == false)//check if dead player is allowed to enter
             {
@@ -177,7 +177,7 @@
         int teamscore = 0;
         if(!player || this->getTeam(player) == -1)
             return 0;
-        for (auto& mapEntry : this->players_)
+        for (const auto& mapEntry : this->players_)
         {
             if ( this->getTeam(mapEntry.first) ==  this->getTeam(player) )
             {
@@ -190,7 +190,7 @@
     int TeamGametype::getTeamSize(int team)
     {
         int teamSize = 0;
-        for (auto& mapEntry : this->teamnumbers_)
+        for (const auto& mapEntry : this->teamnumbers_)
         {
             if (mapEntry.second == team)
                 teamSize++;
@@ -201,7 +201,7 @@
     int TeamGametype::getHumansInTeam(int team)
     {
         int teamSize = 0;
-        for (auto& mapEntry : this->teamnumbers_)
+        for (const auto& mapEntry : this->teamnumbers_)
         {
             if (mapEntry.second == team  && mapEntry.first->isHumanPlayer())
                 teamSize++;
@@ -375,7 +375,7 @@
 
     void TeamGametype::announceTeamWin(int winnerTeam)
     {
-        for (auto& mapEntry : this->teamnumbers_)
+        for (const auto& mapEntry : this->teamnumbers_)
         {
             if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
                 continue;

Modified: code/branches/cpp11_v2/src/orxonox/gametypes/UnderAttack.cc
===================================================================
--- code/branches/cpp11_v2/src/orxonox/gametypes/UnderAttack.cc	2015-12-02 22:22:03 UTC (rev 10916)
+++ code/branches/cpp11_v2/src/orxonox/gametypes/UnderAttack.cc	2015-12-02 22:32:08 UTC (rev 10917)
@@ -73,7 +73,7 @@
         ChatManager::message(message);
         this->gameEnded_ = true;
 
-        for (auto& mapEntry : this->teamnumbers_)
+        for (const auto& mapEntry : this->teamnumbers_)
         {
             if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
                 continue;
@@ -154,7 +154,7 @@
                 std::string message("Time is up! Team 1 has won!");
                 ChatManager::message(message);
 
-                for (auto& mapEntry : this->teamnumbers_)
+                for (const auto& mapEntry : this->teamnumbers_)
                 {
                     if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
                         continue;

Modified: code/branches/cpp11_v2/src/orxonox/weaponsystem/Munition.cc
===================================================================
--- code/branches/cpp11_v2/src/orxonox/weaponsystem/Munition.cc	2015-12-02 22:22:03 UTC (rev 10916)
+++ code/branches/cpp11_v2/src/orxonox/weaponsystem/Munition.cc	2015-12-02 22:32:08 UTC (rev 10917)
@@ -54,7 +54,7 @@
 
     Munition::~Munition()
     {
-        for (auto& mapEntry : this->currentMagazines_)
+        for (const auto& mapEntry : this->currentMagazines_)
             delete mapEntry.second;
     }
 
@@ -315,7 +315,7 @@
             while (amount > 0)
             {
                 bool change = false;
-                for (auto& mapEntry : this->currentMagazines_)
+                for (const auto& mapEntry : this->currentMagazines_)
                 {
                     // Add munition if the magazine isn't full (but only to loaded magazines)
                     if (amount > 0 && mapEntry.second->munition_ < this->maxMunitionPerMagazine_ && mapEntry.second->bLoaded_)

Modified: code/branches/cpp11_v2/src/orxonox/weaponsystem/Weapon.cc
===================================================================
--- code/branches/cpp11_v2/src/orxonox/weaponsystem/Weapon.cc	2015-12-02 22:22:03 UTC (rev 10916)
+++ code/branches/cpp11_v2/src/orxonox/weaponsystem/Weapon.cc	2015-12-02 22:32:08 UTC (rev 10917)
@@ -60,7 +60,7 @@
             if (this->weaponPack_)
                 this->weaponPack_->removeWeapon(this);
 
-            for (auto& mapEntry : this->weaponmodes_)
+            for (const auto& mapEntry : this->weaponmodes_)
                 mapEntry.second->destroy();
         }
     }
@@ -135,7 +135,7 @@
 
     void Weapon::reload()
     {
-        for (auto& mapEntry : this->weaponmodes_)
+        for (const auto& mapEntry : this->weaponmodes_)
             mapEntry.second->reload();
     }
 
@@ -147,7 +147,7 @@
 
     void Weapon::notifyWeaponModes()
     {
-        for (auto& mapEntry : this->weaponmodes_)
+        for (const auto& mapEntry : this->weaponmodes_)
             mapEntry.second->setWeapon(this);
     }
 }

Modified: code/branches/cpp11_v2/src/orxonox/weaponsystem/WeaponSet.cc
===================================================================
--- code/branches/cpp11_v2/src/orxonox/weaponsystem/WeaponSet.cc	2015-12-02 22:22:03 UTC (rev 10916)
+++ code/branches/cpp11_v2/src/orxonox/weaponsystem/WeaponSet.cc	2015-12-02 22:32:08 UTC (rev 10917)
@@ -62,7 +62,7 @@
     void WeaponSet::fire()
     {
         // Fire all WeaponPacks with their defined weaponmode
-        for (auto& mapEntry : this->weaponpacks_)
+        for (const auto& mapEntry : this->weaponpacks_)
             if (mapEntry.second != WeaponSystem::WEAPON_MODE_UNASSIGNED)
                 mapEntry.first->fire(mapEntry.second);
     }
@@ -70,7 +70,7 @@
     void WeaponSet::reload()
     {
         // Reload all WeaponPacks with their defined weaponmode
-        for (auto& mapEntry : this->weaponpacks_)
+        for (const auto& mapEntry : this->weaponpacks_)
             mapEntry.first->reload();
     }
 

Modified: code/branches/cpp11_v2/src/orxonox/weaponsystem/WeaponSystem.cc
===================================================================
--- code/branches/cpp11_v2/src/orxonox/weaponsystem/WeaponSystem.cc	2015-12-02 22:22:03 UTC (rev 10916)
+++ code/branches/cpp11_v2/src/orxonox/weaponsystem/WeaponSystem.cc	2015-12-02 22:32:08 UTC (rev 10917)
@@ -195,7 +195,7 @@
         }
 
         // Assign the desired weaponmode to the firemodes
-        for (auto& mapEntry : this->weaponSets_)
+        for (const auto& mapEntry : this->weaponSets_)
         {
             unsigned int weaponmode = wPack->getDesiredWeaponmode(mapEntry.first);
             if (weaponmode != WeaponSystem::WEAPON_MODE_UNASSIGNED)
@@ -218,7 +218,7 @@
                 weapon->getWeaponSlot()->removeWeapon();
 
         // Remove all added links from the WeaponSets
-        for (auto& mapEntry : this->weaponSets_)
+        for (const auto& mapEntry : this->weaponSets_)
             mapEntry.second->removeWeaponmodeLink(wPack);
 
         // Remove the WeaponPack from the WeaponSystem
@@ -267,7 +267,7 @@
 
         // Check if the WeaponSet belongs to this WeaponSystem
         bool foundWeaponSet = false;
-        for (auto& mapEntry : this->weaponSets_)
+        for (const auto& mapEntry : this->weaponSets_)
         {
             if (mapEntry.second == wSet)
             {
@@ -295,7 +295,7 @@
 
     void WeaponSystem::reload()
     {
-        for (auto& mapEntry : this->weaponSets_)
+        for (const auto& mapEntry : this->weaponSets_)
             mapEntry.second->reload();
     }
 




More information about the Orxonox-commit mailing list