Index: code/branches/presentation/src/orxonox/gamestates/GSLevel.cc
===================================================================
--- code/branches/presentation/src/orxonox/gamestates/GSLevel.cc	(revision 2460)
+++ code/branches/presentation/src/orxonox/gamestates/GSLevel.cc	(revision 2485)
@@ -41,10 +41,9 @@
 #include "core/CoreIncludes.h"
 #include "core/Core.h"
-//#include "objects/Backlight.h"
 #include "objects/Tickable.h"
 #include "objects/Radar.h"
-//#include "tools/ParticleInterface.h"
 #include "CameraManager.h"
 #include "LevelManager.h"
+#include "PlayerManager.h"
 #include "Settings.h"
 
@@ -55,6 +54,5 @@
     GSLevel::GSLevel()
 //        : GameState<GSGraphics>(name)
-        : timeFactor_(1.0f)
-        , keyBinder_(0)
+        : keyBinder_(0)
         , inputState_(0)
         , radar_(0)
@@ -64,4 +62,8 @@
     {
         RegisterObject(GSLevel);
+
+        this->ccKeybind_ = 0;
+        this->ccTkeybind_ = 0;
+
         setConfigValues();
     }
@@ -95,11 +97,10 @@
         }
 
+        this->playerManager_ = new PlayerManager();
+
         if (Core::isMaster())
         {
             // create the global LevelManager
             this->levelManager_ = new LevelManager();
-
-            // reset game speed to normal
-            timeFactor_ = 1.0f;
 
             this->loadLevel();
@@ -114,8 +115,10 @@
             FunctorMember<GSLevel>* functor1 = createFunctor(&GSLevel::keybind);
             functor1->setObject(this);
-            CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(functor1, "keybind"));
+            ccKeybind_ = createConsoleCommand(functor1, "keybind");
+            CommandExecutor::addConsoleCommandShortcut(ccKeybind_);
             FunctorMember<GSLevel>* functor2 = createFunctor(&GSLevel::tkeybind);
             functor2->setObject(this);
-            CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(functor2, "tkeybind"));
+            ccTkeybind_ = createConsoleCommand(functor2, "tkeybind");
+            CommandExecutor::addConsoleCommandShortcut(ccTkeybind_);
             // set our console command as callback for the key detector
             InputManager::getInstance().setKeyDetectorCallback(std::string("keybind ") + keyDetectorCallbackCode_);
@@ -124,16 +127,20 @@
             InputManager::getInstance().requestEnterState("game");
         }
-
-        if (Core::isMaster())
-        {
-            // time factor console command
-            FunctorMember<GSLevel>* functor = createFunctor(&GSLevel::setTimeFactor);
-            functor->setObject(this);
-            CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(functor, "setTimeFactor")).accessLevel(AccessLevel::Offline).defaultValue(0, 1.0);;
-        }
     }
 
     void GSLevel::leave()
     {
+        // destroy console commands
+        if (this->ccKeybind_)
+        {
+            delete this->ccKeybind_;
+            this->ccKeybind_ = 0;
+        }
+        if (this->ccTkeybind_)
+        {
+            delete this->ccTkeybind_;
+            this->ccTkeybind_ = 0;
+        }
+
         // this call will delete every BaseObject!
         // But currently this will call methods of objects that exist no more
@@ -149,11 +156,26 @@
 
         if (this->radar_)
+        {
             delete this->radar_;
+            this->radar_ = 0;
+        }
 
         if (this->cameraManager_)
+        {
             delete this->cameraManager_;
+            this->cameraManager_ = 0;
+        }
 
         if (this->levelManager_)
+        {
             delete this->levelManager_;
+            this->levelManager_ = 0;
+        }
+
+        if (this->playerManager_)
+        {
+            delete this->playerManager_;
+            this->playerManager_ = 0;
+        }
 
         if (Core::showsGraphics())
@@ -162,5 +184,8 @@
             InputManager::getInstance().requestDestroyState("game");
             if (this->keyBinder_)
+            {
                 delete this->keyBinder_;
+                this->keyBinder_ = 0;
+            }
         }
     }
@@ -172,23 +197,4 @@
         //for (ObjectList<Tickable>::iterator it = ObjectList<Tickable>::begin(); it; ++it)
         //    it->tick(time.getDeltaTime() * this->timeFactor_);
-    }
-
-    /**
-    @brief
-        Changes the speed of Orxonox
-    */
-    void GSLevel::setTimeFactor(float factor)
-    {
-/*
-        float change = factor / this->timeFactor_;
-*/
-        this->timeFactor_ = factor;
-/*
-        for (ObjectList<ParticleInterface>::iterator it = ObjectList<ParticleInterface>::begin(); it; ++it)
-            it->setSpeedFactor(it->getSpeedFactor() * change);
-
-        for (ObjectList<Backlight>::iterator it = ObjectList<Backlight>::begin(); it; ++it)
-            it->setTimeFactor(timeFactor_);
-*/
     }
 
