Index: code/branches/hudelements/src/modules/overlays/hud/HUDNavigation.cc
===================================================================
--- code/branches/hudelements/src/modules/overlays/hud/HUDNavigation.cc	(revision 6907)
+++ code/branches/hudelements/src/modules/overlays/hud/HUDNavigation.cc	(revision 6914)
@@ -100,7 +100,7 @@
     {
         activeObjectListType::iterator it;
-        for( it = activeObjectList_.begin(); it!=activeObjectList_.end(); )
+        for( it = activeObjectList_.begin(); it!=activeObjectList_.end(); ++it )
         {
-            removeObject((it++)->first);
+            removeObject(it->first);
         }
         activeObjectList_.clear();
@@ -124,6 +124,6 @@
         for (tempRadarViewable = activeObjectList_.begin(); tempRadarViewable!=activeObjectList_.end(); ++tempRadarViewable)
         {
-            if (tempRadarViewable->second.second && !fontName_.empty())
-                tempRadarViewable->second.second->setFontName(fontName_);
+            if (tempRadarViewable->second.text_ && !fontName_.empty())
+                tempRadarViewable->second.text_->setFontName(fontName_);
         }
     }
@@ -142,6 +142,6 @@
         for (tempRadarViewable = activeObjectList_.begin(); tempRadarViewable!=activeObjectList_.end(); ++tempRadarViewable)
         {
-            if (tempRadarViewable->second.second && size >= 0.0f)
-                tempRadarViewable->second.second->setCharHeight(size);
+            if (tempRadarViewable->second.text_ && size >= 0.0f)
+                tempRadarViewable->second.text_->setCharHeight(size);
         }
     }
@@ -185,6 +185,6 @@
             //get Distance to HumanController and save it in the TextAreaOverlayElement.
             int dist = (int)(tempRadarViewable->first->getRVWorldPosition() - HumanController::getLocalControllerEntityAsPawn()->getWorldPosition()).length();
-            tempRadarViewable->second.second->setCaption(multi_cast<std::string>(dist));
-            float textLength = multi_cast<std::string>(dist).size() * tempRadarViewable->second.second->getCharHeight() * 0.3f;
+            tempRadarViewable->second.text_->setCaption(multi_cast<std::string>(dist));
+            float textLength = multi_cast<std::string>(dist).size() * tempRadarViewable->second.text_->getCharHeight() * 0.3f;
 
 
@@ -199,9 +199,9 @@
 
 
-            bool outOfView;
+
             if (pos.z > 1.0)
             {
                 // z > 1.0 means that the object is behind the camera
-                outOfView = true;
+                tempRadarViewable->second.outOfView_ = true;
                 // we have to switch all coordinates (if you don't know why,
                 // try linear algebra lectures, because I can't explain..)
@@ -210,15 +210,15 @@
             }
             else
-                outOfView = pos.x < -1.0 || pos.x > 1.0 || pos.y < -1.0 || pos.y > 1.0;
-
-            if (outOfView)
+                tempRadarViewable->second.outOfView_ = pos.x < -1.0 || pos.x > 1.0 || pos.y < -1.0 || pos.y > 1.0;
+
+            if (tempRadarViewable->second.outOfView_)
             {
                 // object is not in view
 //            aimMarker_->hide();
 
-                if (!wasOutOfView_)
+                if (!tempRadarViewable->second.wasOutOfView__)
                 {
-                    tempRadarViewable->second.first->setMaterialName("Orxonox/NavArrows");
-                    wasOutOfView_ = true;
+                    tempRadarViewable->second.panel_->setMaterialName("Orxonox/NavArrows");
+                    tempRadarViewable->second.wasOutOfView__ = true;
                 }
 
@@ -231,8 +231,8 @@
                         // up
                         float position = pos.x / pos.y + 1.0f;
-                        tempRadarViewable->second.first->setPosition((position - tempRadarViewable->second.first->getWidth()) * 0.5f, 0.0f);
-                        tempRadarViewable->second.first->setUV(0.5f, 0.0f, 1.0f, 0.5f);
-                        tempRadarViewable->second.second->setLeft((position - textLength) * 0.5f);
-                        tempRadarViewable->second.second->setTop(tempRadarViewable->second.first->getHeight());
+                        tempRadarViewable->second.panel_->setPosition((position - tempRadarViewable->second.panel_->getWidth()) * 0.5f, 0.0f);
+                        tempRadarViewable->second.panel_->setUV(0.5f, 0.0f, 1.0f, 0.5f);
+                        tempRadarViewable->second.text_->setLeft((position - textLength) * 0.5f);
+                        tempRadarViewable->second.text_->setTop(tempRadarViewable->second.panel_->getHeight());
                     }
                     else
@@ -240,8 +240,8 @@
                         // left
                         float position = pos.y / pos.x + 1.0f;
-                        tempRadarViewable->second.first->setPosition(0.0f, (position - tempRadarViewable->second.first->getWidth()) * 0.5f);
-                        tempRadarViewable->second.first->setUV(0.0f, 0.0f, 0.5f, 0.5f);
-                        tempRadarViewable->second.second->setLeft(tempRadarViewable->second.first->getWidth() + 0.01f);
-                        tempRadarViewable->second.second->setTop((position - tempRadarViewable->second.second->getCharHeight()) * 0.5f);
+                        tempRadarViewable->second.panel_->setPosition(0.0f, (position - tempRadarViewable->second.panel_->getWidth()) * 0.5f);
+                        tempRadarViewable->second.panel_->setUV(0.0f, 0.0f, 0.5f, 0.5f);
+                        tempRadarViewable->second.text_->setLeft(tempRadarViewable->second.panel_->getWidth() + 0.01f);
+                        tempRadarViewable->second.text_->setTop((position - tempRadarViewable->second.text_->getCharHeight()) * 0.5f);
                     }
                 }
@@ -253,8 +253,8 @@
                         // down
                         float position = -pos.x / pos.y + 1.0f;
-                        tempRadarViewable->second.first->setPosition((position - tempRadarViewable->second.first->getWidth()) * 0.5f, 1.0f - tempRadarViewable->second.first->getHeight());
-                        tempRadarViewable->second.first->setUV(0.0f, 0.5f, 0.5f, 1.0f);
-                        tempRadarViewable->second.second->setLeft((position - textLength) * 0.5f);
-                        tempRadarViewable->second.second->setTop(1.0f - tempRadarViewable->second.first->getHeight() - tempRadarViewable->second.second->getCharHeight());
+                        tempRadarViewable->second.panel_->setPosition((position - tempRadarViewable->second.panel_->getWidth()) * 0.5f, 1.0f - tempRadarViewable->second.panel_->getHeight());
+                        tempRadarViewable->second.panel_->setUV(0.0f, 0.5f, 0.5f, 1.0f);
+                        tempRadarViewable->second.text_->setLeft((position - textLength) * 0.5f);
+                        tempRadarViewable->second.text_->setTop(1.0f - tempRadarViewable->second.panel_->getHeight() - tempRadarViewable->second.text_->getCharHeight());
                     }
                     else
@@ -262,8 +262,8 @@
                         // right
                         float position = -pos.y / pos.x + 1.0f;
-                        tempRadarViewable->second.first->setPosition(1.0f - tempRadarViewable->second.first->getWidth(), (position - tempRadarViewable->second.first->getHeight()) * 0.5f);
-                        tempRadarViewable->second.first->setUV(0.5f, 0.5f, 1.0f, 1.0f);
-                        tempRadarViewable->second.second->setLeft(1.0f - tempRadarViewable->second.first->getWidth() - textLength - 0.01f);
-                        tempRadarViewable->second.second->setTop((position - tempRadarViewable->second.second->getCharHeight()) * 0.5f);
+                        tempRadarViewable->second.panel_->setPosition(1.0f - tempRadarViewable->second.panel_->getWidth(), (position - tempRadarViewable->second.panel_->getHeight()) * 0.5f);
+                        tempRadarViewable->second.panel_->setUV(0.5f, 0.5f, 1.0f, 1.0f);
+                        tempRadarViewable->second.text_->setLeft(1.0f - tempRadarViewable->second.panel_->getWidth() - textLength - 0.01f);
+                        tempRadarViewable->second.text_->setTop((position - tempRadarViewable->second.text_->getCharHeight()) * 0.5f);
                     }
                 }
@@ -278,14 +278,14 @@
                                     Projectile::getSpeed(), Radar::getInstance().getFocus()->getRVWorldPosition(), Radar::getInstance().getFocus()->getRVOrientedVelocity());
                 */
-                if (wasOutOfView_)
+                if (tempRadarViewable->second.wasOutOfView_)
                 {
-                    tempRadarViewable->second.first->setMaterialName("Orxonox/NavTDC");
-                    wasOutOfView_ = false;
+                    tempRadarViewable->second.panel_->setMaterialName("Orxonox/NavTDC");
+                    tempRadarViewable->second.wasOutOfView__ = false;
                 }
 
                 // object is in view
-                tempRadarViewable->second.first->setUV(0.0f, 0.0f, 1.0f, 1.0f);
-                tempRadarViewable->second.first->setLeft((pos.x + 1.0f - tempRadarViewable->second.first->getWidth()) * 0.5f);
-                tempRadarViewable->second.first->setTop((-pos.y + 1.0f - tempRadarViewable->second.first->getHeight()) * 0.5f);
+                tempRadarViewable->second.panel_->setUV(0.0f, 0.0f, 1.0f, 1.0f);
+                tempRadarViewable->second.panel_->setLeft((pos.x + 1.0f - tempRadarViewable->second.panel_->getWidth()) * 0.5f);
+                tempRadarViewable->second.panel_->setTop((-pos.y + 1.0f - tempRadarViewable->second.panel_->getHeight()) * 0.5f);
 
 
@@ -294,11 +294,11 @@
 //                 aimMarker_->setTop((-aimpos.y + 1.0f - aimMarker_->getHeight()) * 0.5f);
 //
-                tempRadarViewable->second.second->setLeft((pos.x + 1.0f + tempRadarViewable->second.first->getWidth()) * 0.5f);
-                tempRadarViewable->second.second->setTop((-pos.y + 1.0f + tempRadarViewable->second.first->getHeight()) * 0.5f);
+                tempRadarViewable->second.text_->setLeft((pos.x + 1.0f + tempRadarViewable->second.panel_->getWidth()) * 0.5f);
+                tempRadarViewable->second.text_->setTop((-pos.y + 1.0f + tempRadarViewable->second.panel_->getHeight()) * 0.5f);
             }
 
-            tempRadarViewable->second.first->show();
-            tempRadarViewable->second.second->show();
-//             tempRadarViewable->second.second->hide();
+            tempRadarViewable->second.panel_->show();
+            tempRadarViewable->second.text_->show();
+//             tempRadarViewable->second.text_->hide();
         }
 
@@ -332,10 +332,10 @@
         {
 
-            if (tempRadarViewable->second.first)
-                tempRadarViewable->second.first->setDimensions(navMarkerSize_ * xScale, navMarkerSize_ * yScale);
+            if (tempRadarViewable->second.panel_)
+                tempRadarViewable->second.panel_->setDimensions(navMarkerSize_ * xScale, navMarkerSize_ * yScale);
 //            if (this->aimMarker_)
 //            aimMarker_->setDimensions(aimMarkerSize_ * xScale, aimMarkerSize_ * yScale);
-            if (tempRadarViewable->second.second)
-                tempRadarViewable->second.second->setCharHeight(tempRadarViewable->second.second->getCharHeight() * yScale);
+            if (tempRadarViewable->second.text_)
+                tempRadarViewable->second.text_->setCharHeight(tempRadarViewable->second.text_->getCharHeight() * yScale);
         }
     }
@@ -371,5 +371,6 @@
     text->setCharHeight(text->getCharHeight() * yScale);
 
-    activeObjectList_[object] = std::make_pair (panel, text) ;
+    objectStruct tempStruct = {panel, text, true};
+    activeObjectList_[object] = tempStruct;
 
     this->background_->addChild(panel);
@@ -388,9 +389,9 @@
     {
         // Remove overlays from Ogre
-        this->background_->removeChild(it->second.first->getName());
-        this->background_->removeChild(it->second.second->getName());
+        this->background_->removeChild(it->second.panel_->getName());
+        this->background_->removeChild(it->second.text_->getName());
         // correctly destroy the overlay elements
-        Ogre::OverlayManager::getSingleton().destroyOverlayElement(it->second.first);
-        Ogre::OverlayManager::getSingleton().destroyOverlayElement(it->second.second);
+        Ogre::OverlayManager::getSingleton().destroyOverlayElement(it->second.panel_);
+        Ogre::OverlayManager::getSingleton().destroyOverlayElement(it->second.text_);
 
         activeObjectList_.erase(viewable);
