Changeset 7876 for code/trunk/src/orxonox/gamestates/GSLevel.cc
- Timestamp:
- Feb 13, 2011, 5:49:41 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/orxonox/gamestates/GSLevel.cc
r7870 r7876 51 51 DeclareGameState(GSLevel, "level", false, false); 52 52 53 static const std::string __CC_startMainMenu_name = "startMainMenu"; 54 static const std::string __CC_changeGame_name = "changeGame"; 55 56 SetConsoleCommand(__CC_startMainMenu_name, &GSLevel::startMainMenu).deactivate(); 57 SetConsoleCommand(__CC_changeGame_name, &GSLevel::changeGame).defaultValues(BLANKSTRING).deactivate(); 58 53 59 GSLevel::GSLevel(const GameStateInfo& info) 54 60 : GameState(info) … … 94 100 // connect the HumanPlayer to the game 95 101 PlayerManager::getInstance().clientConnected(0); 96 } 102 103 ModifyConsoleCommand(__CC_startMainMenu_name).activate(); 104 } 105 106 if (GameMode::isStandalone()) 107 ModifyConsoleCommand(__CC_changeGame_name).activate(); 97 108 } 98 109 … … 121 132 InputManager::getInstance().destroyState("guiKeysOnly"); 122 133 InputManager::getInstance().destroyState("guiMouseOnly"); 123 } 134 135 ModifyConsoleCommand(__CC_startMainMenu_name ).deactivate(); 136 } 137 138 if (GameMode::isStandalone()) 139 ModifyConsoleCommand(__CC_changeGame_name).deactivate(); 124 140 } 125 141 … … 166 182 COUT(3) << " Try harder!" << std::endl; 167 183 } 184 185 /** 186 @brief 187 Starts the MainMenu. 188 */ 189 /*static*/ void GSLevel::startMainMenu(void) 190 { 191 // HACK 192 Game::getInstance().popState(); 193 Game::getInstance().popState(); 194 } 195 196 /** 197 @brief 198 Terminates the current game and starts a new game. 199 @param level 200 The filename of the level to be started. 201 */ 202 /*static*/ void GSLevel::changeGame(const std::string& level) 203 { 204 if(level != BLANKSTRING) 205 LevelManager::getInstance().setDefaultLevel(level); 206 207 // HACK 208 Game::getInstance().popState(); 209 Game::getInstance().popState(); 210 Game::getInstance().requestStates("standalone, level"); 211 } 168 212 }
Note: See TracChangeset
for help on using the changeset viewer.