Index: code/trunk/src/modules/overlays/hud/HUDWeapon.cc
===================================================================
--- code/trunk/src/modules/overlays/hud/HUDWeapon.cc	(revision 11052)
+++ code/trunk/src/modules/overlays/hud/HUDWeapon.cc	(revision 11071)
@@ -44,5 +44,4 @@
         weaponModeHUDActualSize_ = Vector2(0.0f,0.0f);
 
-        weaponModes_ = NULL;
         weaponIndex_ = 0;
         hudWeaponModes_.clear();
@@ -77,5 +76,5 @@
         if (!weapon_)
         {
-            // TODO: destroy this HUD id the Weapon does no more exist. (Wehen the weak pointer is NULL)
+            // TODO: destroy this HUD id the Weapon does no more exist. (Wehen the weak pointer is null)
         }
     }    
@@ -115,8 +114,8 @@
         bool visible = this->isVisible();
 
-        for (std::vector<WeakPtr<HUDWeaponMode> >::iterator it = hudWeaponModes_.begin(); it != hudWeaponModes_.end(); ++it)
-        {
-            (*it)->changedVisibility(); //inform all Child Overlays that our visibility has changed
-            (*it)->setVisible(visible);
+        for (HUDWeaponMode* hudWeaponMode : hudWeaponModes_)
+        {
+            hudWeaponMode->changedVisibility(); //inform all Child Overlays that our visibility has changed
+            hudWeaponMode->setVisible(visible);
         }
     }
@@ -141,5 +140,5 @@
     void HUDWeapon::updateWeaponModeList()
     {
-        if (owner_ == NULL || weapon_ == NULL)
+        if (owner_ == nullptr || weapon_ == nullptr)
         {
             return;
@@ -147,6 +146,4 @@
             
         destroyHUDChilds();
-
-        weaponModes_ = weapon_->getAllWeaponmodes();
 
         updateSize();
@@ -157,5 +154,5 @@
     void HUDWeapon::createHUDChilds()
     {
-        if (weaponModes_ == NULL)
+        if (weapon_ == nullptr)
         {
             return;
@@ -164,5 +161,5 @@
         int positionIndex = 0;
 
-        for (std::multimap<unsigned int, WeaponMode*>::iterator it = weaponModes_->begin(); it != weaponModes_->end(); ++it)
+        for (const auto& mapEntry : weapon_->getAllWeaponmodes())
         {
             HUDWeaponMode* hudWeaponMode = new HUDWeaponMode(this->getContext());
@@ -170,5 +167,5 @@
             hudWeaponMode->setOverlayGroup(this->getOverlayGroup());
             hudWeaponMode->setVisible(this->isVisible());
-            hudWeaponMode->setWeaponMode(it->second);
+            hudWeaponMode->setWeaponMode(mapEntry.second);
             hudWeaponMode->setWeaponIndex(this->weaponIndex_);                    
             hudWeaponMode->setAspectCorrection(false);
@@ -185,10 +182,10 @@
         int positionIndex = 0;
 
-        for (std::vector<WeakPtr<HUDWeaponMode> >::iterator it = hudWeaponModes_.begin(); it != hudWeaponModes_.end(); ++it)
-        {
-            (*it)->setPositionOffset(this->positionOffset_);
-            (*it)->setWeaponModeIndex(positionIndex);
-            (*it)->setWeaponIndex(this->weaponIndex_);
-            (*it)->setWeaponModeHUDActualSize(this->weaponModeHUDActualSize_);
+        for (HUDWeaponMode* hudWeaponMode : hudWeaponModes_)
+        {
+            hudWeaponMode->setPositionOffset(this->positionOffset_);
+            hudWeaponMode->setWeaponModeIndex(positionIndex);
+            hudWeaponMode->setWeaponIndex(this->weaponIndex_);
+            hudWeaponMode->setWeaponModeHUDActualSize(this->weaponModeHUDActualSize_);
 
             ++ positionIndex;
@@ -198,7 +195,7 @@
     void HUDWeapon::destroyHUDChilds()
     {
-        for (std::vector<WeakPtr<HUDWeaponMode> >::iterator it = hudWeaponModes_.begin(); it != hudWeaponModes_.end(); ++it)
-        {
-            (*it)->destroy();
+        for (HUDWeaponMode* hudWeaponMode : hudWeaponModes_)
+        {
+            hudWeaponMode->destroy();
         } 
 
@@ -208,7 +205,7 @@
     void HUDWeapon::updateSize()
     {
-        if (weaponModes_ != NULL)
-        {
-            this->setSize(Vector2(weaponModeHUDActualSize_.x,weaponModeHUDActualSize_.y*weaponModes_->size()));
+        if (weapon_ != nullptr)
+        {
+            this->setSize(Vector2(weaponModeHUDActualSize_.x,weaponModeHUDActualSize_.y*weapon_->getAllWeaponmodes().size()));
             updatePosition();
         }        
@@ -217,5 +214,5 @@
     void HUDWeapon::updatePosition()
     {
-        if (weaponModes_ != NULL)
+        if (weapon_ != nullptr)
         {
             this->setPosition(Vector2(weaponModeHUDActualSize_.x*weaponIndex_,0.0f) + this->positionOffset_);
