[Orxonox-commit 718] r3249 - in branches/core4/src/orxonox: . gamestates

rgrieder at orxonox.net rgrieder at orxonox.net
Mon Jun 29 16:01:35 CEST 2009


Author: rgrieder
Date: 2009-06-29 16:01:35 +0200 (Mon, 29 Jun 2009)
New Revision: 3249

Modified:
   branches/core4/src/orxonox/LevelManager.cc
   branches/core4/src/orxonox/LevelManager.h
   branches/core4/src/orxonox/gamestates/GSLevel.cc
Log:
StartLevel --> DefaultLevel and moved the CommandLine argument (--level) to the LevelManager.

Modified: branches/core4/src/orxonox/LevelManager.cc
===================================================================
--- branches/core4/src/orxonox/LevelManager.cc	2009-06-29 12:18:20 UTC (rev 3248)
+++ branches/core4/src/orxonox/LevelManager.cc	2009-06-29 14:01:35 UTC (rev 3249)
@@ -39,6 +39,8 @@
 
 namespace orxonox
 {
+    SetCommandLineArgument(level, "").shortcut("l");
+
     LevelManager* LevelManager::singletonRef_s = 0;
 
     LevelManager::LevelManager()
@@ -52,7 +54,7 @@
         // check override
         if (!CommandLine::getArgument("level")->hasDefaultValue())
         {
-            ModifyConfigValue(startLevelName_, tset, CommandLine::getValue("mediaPath").getString());
+            ModifyConfigValue(defaultLevelName_, tset, CommandLine::getValue("mediaPath").getString());
         }
     }
 
@@ -64,7 +66,7 @@
 
     void LevelManager::setConfigValues()
     {
-        SetConfigValue(startLevelName_, "presentation_dm.oxw")
+        SetConfigValue(defaultLevelName_, "presentation_dm.oxw")
             .description("Sets the preselection of the level in the main menu.");
     }
 
@@ -112,13 +114,13 @@
         }
     }
 
-    void LevelManager::setStartLevel(const std::string& levelName)
+    void LevelManager::setDefaultLevel(const std::string& levelName)
     {
-        ModifyConfigValue(startLevelName_, set, levelName);
+        ModifyConfigValue(defaultLevelName_, set, levelName);
     }
 
-    const std::string& LevelManager::getStartLevel()
+    const std::string& LevelManager::getDefaultLevel()
     {
-        return startLevelName_;
+        return defaultLevelName_;
     }
 }

Modified: branches/core4/src/orxonox/LevelManager.h
===================================================================
--- branches/core4/src/orxonox/LevelManager.h	2009-06-29 12:18:20 UTC (rev 3248)
+++ branches/core4/src/orxonox/LevelManager.h	2009-06-29 14:01:35 UTC (rev 3249)
@@ -52,8 +52,8 @@
             void releaseActivity(Level* level);
             Level* getActiveLevel();
 
-            void setStartLevel(const std::string& levelName); //tolua_export
-            const std::string& getStartLevel(); //tolua_export
+            void setDefaultLevel(const std::string& levelName); //tolua_export
+            const std::string& getDefaultLevel(); //tolua_export
 
             static LevelManager* getInstancePtr() { return singletonRef_s; }
             static LevelManager& getInstance() { assert(singletonRef_s); return *singletonRef_s; } // tolua_export
@@ -66,7 +66,7 @@
             std::list<Level*> levels_s;
 
             // config values
-            std::string startLevelName_;
+            std::string defaultLevelName_;
 
             static LevelManager* singletonRef_s;
     }; // tolua_export

Modified: branches/core4/src/orxonox/gamestates/GSLevel.cc
===================================================================
--- branches/core4/src/orxonox/gamestates/GSLevel.cc	2009-06-29 12:18:20 UTC (rev 3248)
+++ branches/core4/src/orxonox/gamestates/GSLevel.cc	2009-06-29 14:01:35 UTC (rev 3249)
@@ -33,7 +33,6 @@
 #include "core/input/SimpleInputState.h"
 #include "core/input/KeyBinder.h"
 #include "core/Clock.h"
-#include "core/CommandLine.h"
 #include "core/ConsoleCommand.h"
 #include "core/ConfigValueIncludes.h"
 #include "core/CoreIncludes.h"
@@ -56,8 +55,6 @@
 namespace orxonox
 {
     DeclareGameState(GSLevel, "level", false, true);
-
-    SetCommandLineArgument(level, "").shortcut("l");
     SetConsoleCommand(GSLevel, showIngameGUI, true);
 
     XMLFile* GSLevel::startFile_s = NULL;
@@ -241,12 +238,7 @@
     {
         // call the loader
         COUT(0) << "Loading level..." << std::endl;
-        std::string levelName;
-        CommandLine::getValue("level", &levelName);
-        if (levelName == "")
-            startFile_s = new XMLFile(Core::getMediaPathString() + "levels" + '/' + LevelManager::getInstance().getStartLevel());
-        else
-            startFile_s = new XMLFile(Core::getMediaPathString() + "levels" + '/' + levelName);
+        startFile_s = new XMLFile(Core::getMediaPathString() + "levels" + '/' + LevelManager::getInstance().getDefaultLevel());
         Loader::open(startFile_s);
     }
 




More information about the Orxonox-commit mailing list