Index: code/branches/cpp11_v3/src/orxonox/weaponsystem/WeaponSystem.cc
===================================================================
--- code/branches/cpp11_v3/src/orxonox/weaponsystem/WeaponSystem.cc	(revision 11053)
+++ code/branches/cpp11_v3/src/orxonox/weaponsystem/WeaponSystem.cc	(revision 11054)
@@ -52,5 +52,5 @@
         RegisterObject(WeaponSystem);
 
-        this->pawn_ = 0;
+        this->pawn_ = nullptr;
     }
 
@@ -60,5 +60,5 @@
         {
             if (this->pawn_)
-                this->pawn_->setWeaponSystem(0);
+                this->pawn_->setWeaponSystem(nullptr);
 
             while (!this->weaponSets_.empty())
@@ -106,11 +106,11 @@
     {
         unsigned int i = 0;
-        for (std::vector<WeaponSlot*>::const_iterator it = this->weaponSlots_.begin(); it != this->weaponSlots_.end(); ++it)
+        for (WeaponSlot* weaponSlot : this->weaponSlots_)
         {
             ++i;
             if (i > index)
-                return (*it);
-        }
-        return 0;
+                return weaponSlot;
+        }
+        return nullptr;
     }
 
@@ -153,11 +153,11 @@
     {
         unsigned int i = 0;
-        for (std::map<unsigned int, WeaponSet*>::const_iterator it = this->weaponSets_.begin(); it != this->weaponSets_.end(); ++it)
+        for (const auto& mapEntry : this->weaponSets_)
         {
             ++i;
             if (i > index)
-                return it->second;
-        }
-        return 0;
+                return mapEntry.second;
+        }
+        return nullptr;
     }
 
@@ -168,7 +168,7 @@
 
         unsigned int freeSlots = 0;
-        for (std::vector<WeaponSlot*>::iterator it = this->weaponSlots_.begin(); it != this->weaponSlots_.end(); ++it)
-        {
-            if (!(*it)->isOccupied())
+        for (WeaponSlot* weaponSlot : this->weaponSlots_)
+        {
+            if (!weaponSlot->isOccupied())
                 ++freeSlots;
         }
@@ -184,10 +184,10 @@
         // Attach all weapons to the first free slots (and to the Pawn)
         unsigned int i = 0;
-        for (std::vector<WeaponSlot*>::iterator it = this->weaponSlots_.begin(); it != this->weaponSlots_.end(); ++it)
-        {
-            if (!(*it)->isOccupied() && i < wPack->getNumWeapons())
+        for (WeaponSlot* weaponSlot : this->weaponSlots_)
+        {
+            if (!weaponSlot->isOccupied() && i < wPack->getNumWeapons())
             {
                 Weapon* weapon = wPack->getWeapon(i);
-                (*it)->attachWeapon(weapon);
+                weaponSlot->attachWeapon(weapon);
                 this->getPawn()->attach(weapon);
                 ++i;
@@ -196,9 +196,9 @@
 
         // Assign the desired weaponmode to the firemodes
-        for (std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.begin(); it != this->weaponSets_.end(); ++it)
-        {
-            unsigned int weaponmode = wPack->getDesiredWeaponmode(it->first);
+        for (const auto& mapEntry : this->weaponSets_)
+        {
+            unsigned int weaponmode = wPack->getDesiredWeaponmode(mapEntry.first);
             if (weaponmode != WeaponSystem::WEAPON_MODE_UNASSIGNED)
-                it->second->setWeaponmodeLink(wPack, weaponmode);
+                mapEntry.second->setWeaponmodeLink(wPack, weaponmode);
         }
 
@@ -213,5 +213,5 @@
         // Remove all weapons from their WeaponSlot
         unsigned int i = 0;
-        Weapon* weapon = 0;
+        Weapon* weapon = nullptr;
         while ((weapon = wPack->getWeapon(i++)))
             if (weapon->getWeaponSlot())
@@ -219,6 +219,6 @@
 
         // Remove all added links from the WeaponSets
-        for (std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.begin(); it != this->weaponSets_.end(); ++it)
-            it->second->removeWeaponmodeLink(wPack);
+        for (const auto& mapEntry : this->weaponSets_)
+            mapEntry.second->removeWeaponmodeLink(wPack);
 
         // Remove the WeaponPack from the WeaponSystem
@@ -231,11 +231,11 @@
     {
         unsigned int i = 0;
-        for (std::vector<WeaponPack*>::const_iterator it = this->weaponPacks_.begin(); it != this->weaponPacks_.end(); ++it)
+        for (WeaponPack* weaponPack : this->weaponPacks_)
         {
             ++i;
             if (i > index)
-                return (*it);
-        }
-        return 0;
+                return weaponPack;
+        }
+        return nullptr;
     }
 
@@ -273,7 +273,7 @@
         // Check if the WeaponSet belongs to this WeaponSystem
         bool foundWeaponSet = false;
-        for (std::map<unsigned int, WeaponSet *>::iterator it2 = this->weaponSets_.begin(); it2 != this->weaponSets_.end(); ++it2)
-        {
-            if (it2->second == wSet)
+        for (const auto& mapEntry : this->weaponSets_)
+        {
+            if (mapEntry.second == wSet)
             {
                 foundWeaponSet = true;
@@ -301,6 +301,6 @@
     void WeaponSystem::reload()
     {
-        for (std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.begin(); it != this->weaponSets_.end(); ++it)
-            it->second->reload();
+        for (const auto& mapEntry : this->weaponSets_)
+            mapEntry.second->reload();
     }
 
@@ -308,5 +308,5 @@
     {
         if (!identifier || !identifier->getIdentifier())
-            return 0;
+            return nullptr;
 
         std::map<Identifier *, Munition *>::iterator it = this->munitions_.find(identifier->getIdentifier());
@@ -337,5 +337,5 @@
         else
         {
-            orxout(internal_warning) << "Adding munition failed. identifier == NULL " << endl;
+            orxout(internal_warning) << "Adding munition failed. identifier == nullptr " << endl;
         }
     }
