[Orxonox-commit 1201] r5922 - code/branches/core5/src/orxonox/gamestates

landauf at orxonox.net landauf at orxonox.net
Fri Oct 9 17:15:14 CEST 2009


Author: landauf
Date: 2009-10-09 17:15:14 +0200 (Fri, 09 Oct 2009)
New Revision: 5922

Modified:
   code/branches/core5/src/orxonox/gamestates/GSLevel.cc
   code/branches/core5/src/orxonox/gamestates/GSLevel.h
Log:
list of remaining objects after a level unloading

Modified: code/branches/core5/src/orxonox/gamestates/GSLevel.cc
===================================================================
--- code/branches/core5/src/orxonox/gamestates/GSLevel.cc	2009-10-09 15:09:26 UTC (rev 5921)
+++ code/branches/core5/src/orxonox/gamestates/GSLevel.cc	2009-10-09 15:15:14 UTC (rev 5922)
@@ -149,6 +149,9 @@
 
     void GSLevel::loadLevel()
     {
+        for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it != ObjectList<BaseObject>::end(); ++it)
+            this->staticObjects_.insert(*it);
+        
         // call the loader
         COUT(0) << "Loading level..." << std::endl;
         startFile_ = new XMLFile(LevelManager::getInstance().getDefaultLevel());
@@ -159,5 +162,21 @@
     {
         Loader::unload(startFile_);
         delete startFile_;
+
+        COUT(3) << "Unloaded level. Remaining objects:" << std::endl;
+        unsigned int i = 0;
+        for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it != ObjectList<BaseObject>::end(); ++it)
+        {
+            std::set<BaseObject*>::const_iterator find = this->staticObjects_.find(*it);
+            if (find == this->staticObjects_.end())
+            {
+                COUT(3) << ++i << ": " << it->getIdentifier()->getName() << " (" << *it << ")" << std::endl;
+            }
+        }
+        COUT(3) << i << " objects remaining.";
+        if (i == 0)
+            COUT(3) << " Well done!" << std::endl;
+        else
+            COUT(3) << " Try harder!" << std::endl;
     }
 }

Modified: code/branches/core5/src/orxonox/gamestates/GSLevel.h
===================================================================
--- code/branches/core5/src/orxonox/gamestates/GSLevel.h	2009-10-09 15:09:26 UTC (rev 5921)
+++ code/branches/core5/src/orxonox/gamestates/GSLevel.h	2009-10-09 15:15:14 UTC (rev 5922)
@@ -32,6 +32,7 @@
 #include "OrxonoxPrereqs.h"
 
 #include <string>
+#include <set>
 #include "core/OrxonoxClass.h"
 #include "core/GameState.h"
 
@@ -57,6 +58,7 @@
         InputState*              guiKeysOnlyInputState_;   //!< input state if we only need the keys to use the GUI
 
         XMLFile* startFile_;
+        std::set<BaseObject*> staticObjects_;
     };
 }
 




More information about the Orxonox-commit mailing list