Index: code/trunk/src/orxonox/weaponsystem/Munition.cc
===================================================================
--- code/trunk/src/orxonox/weaponsystem/Munition.cc	(revision 11052)
+++ code/trunk/src/orxonox/weaponsystem/Munition.cc	(revision 11071)
@@ -52,11 +52,11 @@
         this->reloadTime_ = 0.5f;
 
-        this->lastFilledWeaponMode_ = NULL;
+        this->lastFilledWeaponMode_ = nullptr;
     }
 
     Munition::~Munition()
     {
-        for (std::map<WeaponMode*, Magazine*>::iterator it = this->assignedMagazines_.begin(); it != this->assignedMagazines_.end(); ++it)
-            delete it->second;
+        for (const auto& mapEntry : this->assignedMagazines_)
+            delete mapEntry.second;
     }
 
@@ -76,5 +76,5 @@
             // For separated magazines we definitively need a given user
             if (!user)
-                return 0;
+                return nullptr;
 
             // Use the map to get the magazine assigned to the given user
@@ -90,5 +90,5 @@
         }
 
-        return 0;
+        return nullptr;
     }
 
@@ -200,5 +200,5 @@
                     magazine->munition_ = 0;
 
-                    if (this->reload(NULL))
+                    if (this->reload(nullptr))
                         // Successfully reloaded, continue recursively
                         return this->takeMunition(amount, 0);
@@ -262,5 +262,5 @@
         if (deployment_ != MunitionDeployment::Separate)
         {
-            user = NULL;
+            user = nullptr;
         }
 
@@ -271,5 +271,5 @@
             if (it->first == lastFilledWeaponMode_)
             {
-                lastFilledWeaponMode_ = NULL;
+                lastFilledWeaponMode_ = nullptr;
             }            
             delete it->second;
@@ -299,6 +299,6 @@
         {
             // Return true if any of the current magazines is not full (loading counts as full although it returns 0 munition)
-            for (std::map<WeaponMode*, Magazine*>::const_iterator it = this->assignedMagazines_.begin(); it != this->assignedMagazines_.end(); ++it)
-                if (it->second->munition_ < this->maxMunitionPerMagazine_ && it->second->bLoaded_)
+            for (const auto& mapEntry : this->assignedMagazines_)
+                if (mapEntry.second->munition_ < this->maxMunitionPerMagazine_ && mapEntry.second->bLoaded_)
                     return true;
         }
@@ -315,5 +315,5 @@
         {
             // Stacking munition means, if a magazine gets full, the munition adds to a new magazine
-            Magazine* magazine = this->getMagazine(NULL);
+            Magazine* magazine = this->getMagazine(nullptr);
             if (magazine)
             {
@@ -345,7 +345,7 @@
             std::map<WeaponMode*, Magazine*>::iterator it;
 
-            // If the pointer to the weapon mode whose magazine got munition added to is NULL, then set the iterator to the beginning of the map
+            // If the pointer to the weapon mode whose magazine got munition added to is nullptr, then set the iterator to the beginning of the map
             // Otherwise set it to the next weapon mode
-            if (lastFilledWeaponMode_ == NULL)
+            if (lastFilledWeaponMode_ == nullptr)
             {
                 it = this->assignedMagazines_.begin();
@@ -441,9 +441,9 @@
         for (unsigned int i = 0; i < addedMagazines; ++i)
         {
-            for (std::map<WeaponMode*, Magazine*>::iterator it = this->assignedMagazines_.begin(); it != this->assignedMagazines_.end(); ++it)
-            {
-                if (needReload(it->first))
-                {
-                    reload(it->first);
+            for (const auto& mapEntry : this->assignedMagazines_)
+            {
+                if (needReload(mapEntry.first))
+                {
+                    reload(mapEntry.first);
                     break;
                 }
@@ -515,5 +515,5 @@
         // If we don't use separate magazines, set user to 0
         if (deployment_ != MunitionDeployment::Separate)
-            user = NULL;
+            user = nullptr;
 
         // Remove the current magazine for the given user
@@ -523,5 +523,5 @@
             if (it->first == lastFilledWeaponMode_)
             {
-                lastFilledWeaponMode_ = NULL;
+                lastFilledWeaponMode_ = nullptr;
             }
             delete it->second;
