Index: code/branches/gui/src/orxonox/Orxonox.cc
===================================================================
--- code/branches/gui/src/orxonox/Orxonox.cc	(revision 1662)
+++ code/branches/gui/src/orxonox/Orxonox.cc	(revision 1663)
@@ -108,5 +108,4 @@
     , bAbort_(false)
     , timefactor_(1.0f)
-    , mode_(GameMode::GM_Unspecified)
     , debugRefreshTime_(0.0f)
     , graphicsEngine_(0)
@@ -119,5 +118,5 @@
 
     //assert(singletonRef_s == 0);
-    OrxAssert(singletonRef_s == 0, "asdfasdfasdfasdfblahblah");
+    OrxAssert(singletonRef_s == 0, "Cannot instantiate Orxonox class twice");
     singletonRef_s = this;
   }
@@ -229,22 +228,13 @@
         setConfigValues();
 
-        const Settings::CommandLineArgument* mode = Settings::getCommandLineArgument("mode");
-        assert(mode);
-        if (!mode->bHasDefaultValue_)
-        {
-            Settings::setGameMode(mode->value_);
-            this->mode_ = Settings::getGameMode();
-        }
-        COUT(3) << "Orxonox: Game mode is " << mode_.name << "." << std::endl;
-
-        const Settings::CommandLineArgument* dataPath = Settings::getCommandLineArgument("dataPath");
-        assert(dataPath);
-        if (!dataPath->bHasDefaultValue_)
-        {
-            if (*dataPath->value_.getString().end() != '/' && *dataPath->value_.getString().end() != '\\')
-                Settings::tsetDataPath(dataPath->value_.getString() + "/");
-            else
-                Settings::tsetDataPath(dataPath->value_.getString());
-        }
+        //const Settings::CommandLineArgument* dataPath = Settings::getCommandLineArgument("dataPath");
+        //assert(dataPath);
+        //if (!dataPath->bHasDefaultValue_)
+        //{
+        //    if (*dataPath->value_.getString().end() != '/' && *dataPath->value_.getString().end() != '\\')
+        //        Settings::tsetDataPath(dataPath->value_.getString() + "/");
+        //    else
+        //        Settings::tsetDataPath(dataPath->value_.getString());
+        //}
 
         try
@@ -256,5 +246,5 @@
             graphicsEngine_->setup();       // creates ogre root and other essentials
 
-            if (mode_.showsGraphics)
+            if (Settings::showsGraphics())
             {
                 graphicsEngine_->loadRenderer();    // creates the render window
@@ -286,26 +276,4 @@
                 // We probably want to use std::cin to catch input (OIS uses DirectX or X server)
             }
-
-            bool showGUI = true;
-            if (mode_.mode != GameMode::Unspecified)
-            {
-                showGUI = false;
-                // a game mode was specified with the command line
-                // we therefore load the game and level directly
-
-                if (!loadLevel(this->mode_))
-                {
-                    COUT(1) << "Loading with predefined mode failed. Showing main menu." << std::endl;
-                    showGUI = true;
-                    mode_ = GameMode::GM_Unspecified;
-                }
-            }
-
-            if (showGUI)
-            {
-                // show main menu
-                GUIManager::getInstance().showGUI("MainMenu", 0);
-                GraphicsEngine::getInstance().getViewport()->setCamera(GUIManager::getInstance().getCamera());
-            }
         }
         catch (std::exception& ex)
@@ -316,62 +284,12 @@
         }
 
-        modeRequest_ = mode_;
         // here happens the game
         startRenderLoop();
 
-        if (mode_.mode == GameMode::Client)
-            network::Client::getSingleton()->closeConnection();
-
-        if (mode_.hasServer)
-            server_g->close();
-    }
-
-    /*static*/ void Orxonox::loadGame(const std::string& name)
-    {
-        const GameMode& mode = Settings::getGameMode(name);
-        if (mode.mode == GameMode::None)
-            return;
-
-        getInstance().modeRequest_ = mode;
-    }
-
-    bool Orxonox::loadLevel(const GameMode& mode)
-    {
-        bool success = true;
-
-        if (mode.showsGraphics)
-        {
-            // create Ogre SceneManager for the level
-            graphicsEngine_->createNewScene();
-
-            if (!loadPlayground())
-                return false;
-        }
-
-        switch (mode.mode)
-        {
-        case GameMode::Server:
-            success &= serverLoad();
-            break;
-        case GameMode::Client:
-            success &= clientLoad();
-            break;
-        case GameMode::Dedicated:
-            success &= serverLoad();
-            break;
-        case GameMode::Standalone:
-            success &= standaloneLoad();
-            break;
-        default: // never happens
-            assert(false);
-        }
-
-        if (success)
-        {
-            InputManager::getInstance().requestEnterState("game");
-            this->mode_ = mode;
-        }
-
-        return success;
+        //if (mode_.mode == GameMode::Client)
+        //    network::Client::getSingleton()->closeConnection();
+
+        //if (mode_.hasServer)
+        //    server_g->close();
     }
 
@@ -408,8 +326,8 @@
     COUT(0) << "Loading level in server mode" << std::endl;
 
-    assert(Settings::getCommandLineArgument("port"));
-    int serverPort = Settings::getCommandLineArgument("port")->value_;
-    //server_g = new network::Server(serverPort_);
-    server_g = network::Server::createSingleton(serverPort);
+    //assert(Settings::getCommandLineArgument("port"));
+    //int serverPort = Settings::getCommandLineArgument("port")->value_;
+    ////server_g = new network::Server(serverPort_);
+    //server_g = network::Server::createSingleton(serverPort);
 
     if (!loadScene())
@@ -428,13 +346,13 @@
     COUT(0) << "Loading level in client mode" << std::endl;\
 
-    assert(Settings::getCommandLineArgument("port"));
-    assert(Settings::getCommandLineArgument("ip"));
-    int serverPort = Settings::getCommandLineArgument("port")->value_;
-    std::string serverIP = Settings::getCommandLineArgument("ip")->value_;
-
-    if (serverIP.compare("") == 0)
-      client_g = network::Client::createSingleton();
-    else
-      client_g = network::Client::createSingleton(serverIP, serverPort);
+    //assert(Settings::getCommandLineArgument("port"));
+    //assert(Settings::getCommandLineArgument("ip"));
+    //int serverPort = Settings::getCommandLineArgument("port")->value_;
+    //std::string serverIP = Settings::getCommandLineArgument("ip")->value_;
+
+    //if (serverIP.compare("") == 0)
+    //  client_g = network::Client::createSingleton();
+    //else
+    //  client_g = network::Client::createSingleton(serverIP, serverPort);
 
     if(!client_g->establishConnection())
@@ -504,11 +422,4 @@
         float dt = (timeBeforeTick - timeBeforeTickOld) / 1000000.0;
 
-        // check whether we have to load a game
-        if (mode_.mode != modeRequest_.mode && mode_.mode == GameMode::Unspecified)
-        {
-            this->loadLevel(modeRequest_);
-            this->modeRequest_ = GameMode::GM_None;
-        }
-
 
         // tick the core (needs real time for input and tcl thread management)
@@ -552,5 +463,5 @@
         ogreRoot._fireFrameStarted(evt);
 
-        if (mode_.showsGraphics)
+        if (Settings::showsGraphics())
         {
           // Pump messages in all registered RenderWindows
