Changeset 3036
- Timestamp:
- May 24, 2009, 2:39:16 AM (16 years ago)
- Location:
- code/trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/core/CMakeLists.txt
r2896 r3036 67 67 68 68 GENERATE_SOURCE_GROUPS(${CORE_FILES}) 69 GENERATE_TOLUA_BINDINGS(Core CORE_FILES INPUTFILES LuaBind.h CommandExecutor.h )69 GENERATE_TOLUA_BINDINGS(Core CORE_FILES INPUTFILES LuaBind.h CommandExecutor.h Game.h) 70 70 71 71 ADD_LIBRARY(core SHARED ${CORE_FILES}) -
code/trunk/src/core/Game.cc
r2927 r3036 122 122 SetConfigValue(statisticsAvgLength_, 1000000) 123 123 .description("Sets the time in microseconds interval at which average fps, etc. gets calculated."); 124 SetConfigValue(levelName_, "presentation_dm.oxw") 125 .description("Sets the preselection of the level in the main menu."); 126 } 127 128 void Game::setLevel(std::string levelName) 129 { 130 ModifyConfigValue(levelName_, set, levelName); 131 } 132 133 const std::string& Game::getLevel() 134 { 135 std::string levelName; 136 CommandLine::getValue("level", &levelName); 137 if (levelName == "") 138 return levelName_; 139 else 140 return levelName; 124 141 } 125 142 -
code/trunk/src/core/Game.h
r2946 r3036 46 46 static bool MACRO_CONCATENATE(bGameStateDummy_##classname, __LINE__) = orxonox::Game::addGameState(new classname(name)) 47 47 48 // tolua_begin 48 49 namespace orxonox 49 50 { … … 52 53 Main class responsible for running the game. 53 54 */ 54 class _CoreExport Game : public OrxonoxClass 55 class _CoreExport Game 56 // tolua_end 57 : public OrxonoxClass 58 // tolua_begin 55 59 { 60 //tolua_end 56 61 public: 57 62 Game(int argc, char** argv); … … 78 83 static bool addGameState(GameState* state); 79 84 static void destroyStates(); 80 static Game& getInstance() { assert(singletonRef_s); return *singletonRef_s; } 85 static Game& getInstance() { assert(singletonRef_s); return *singletonRef_s; } //tolua_export 86 87 void setLevel(std::string levelName); //tolua_export 88 const std::string& getLevel(); //tolua_export 81 89 82 90 private: … … 114 122 unsigned int statisticsRefreshCycle_; 115 123 unsigned int statisticsAvgLength_; 124 std::string levelName_; 116 125 117 126 static std::map<std::string, GameState*> allStates_s; 118 127 static Game* singletonRef_s; //!< Pointer to the Singleton 128 // tolua_begin 119 129 }; 120 130 } 121 131 //tolua_end 122 132 #endif /* _Game_H__ */ -
code/trunk/src/orxonox/gamestates/GSLevel.cc
r3008 r3036 58 58 AddGameState(GSLevel, "level"); 59 59 60 SetCommandLineArgument(level, " presentation_dm.oxw").shortcut("l");60 SetCommandLineArgument(level, "").shortcut("l"); 61 61 SetConsoleCommand(GSLevel, showIngameGUI, true); 62 SetConsoleCommand(GSLevel, setLevel, true);63 62 64 63 XMLFile* GSLevel::startFile_s = NULL; … … 254 253 COUT(0) << "Loading level..." << std::endl; 255 254 std::string levelName; 256 if (!startFile_s) 257 { 258 CommandLine::getValue("level", &levelName); 255 CommandLine::getValue("level", &levelName); 256 if (levelName == "") 257 startFile_s = new XMLFile(Core::getMediaPathString() + "levels" + '/' + Game::getInstance().getLevel()); 258 else 259 259 startFile_s = new XMLFile(Core::getMediaPathString() + "levels" + '/' + levelName); 260 }261 260 Loader::open(startFile_s); 262 }263 264 void GSLevel::setLevel(std::string levelName)265 {266 delete GSLevel::startFile_s;267 GSLevel::startFile_s = new XMLFile(Core::getMediaPathString() + "levels" + '/' + levelName);268 261 } 269 262
Note: See TracChangeset
for help on using the changeset viewer.