Changeset 2850 for code/branches/gui/src/core/Game.cc
- Timestamp:
- Mar 25, 2009, 11:53:04 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gui/src/core/Game.cc
r2846 r2850 40 40 #include "util/Debug.h" 41 41 #include "util/Exception.h" 42 #include "util/SubString.h" 42 43 #include "Clock.h" 43 44 #include "CommandLine.h" … … 247 248 // Check parent and all its grand parents 248 249 GameStateTreeNode* currentNode = lastRequestedNode; 249 while (requestedNode == NULL && currentNode ->parent_!= NULL)250 while (requestedNode == NULL && currentNode != NULL) 250 251 { 251 252 if (currentNode->state_ == state) … … 260 261 } 261 262 263 void Game::requestStates(const std::string& names) 264 { 265 SubString tokens(names, ",;", " "); 266 for (unsigned int i = 0; i < tokens.size(); ++i) 267 this->requestState(tokens[i]); 268 } 269 262 270 void Game::popState() 263 271 { … … 270 278 GameState* Game::getState(const std::string& name) 271 279 { 272 std::map<std::string, GameState*>::const_iterator it = allStates_s.find( name);280 std::map<std::string, GameState*>::const_iterator it = allStates_s.find(getLowercase(name)); 273 281 if (it != allStates_s.end()) 274 282 return it->second; … … 356 364 void Game::loadState(GameState* state) 357 365 { 366 if (!this->activeStates_.empty()) 367 this->activeStates_.back()->activity_.topState = false; 358 368 state->activate(); 369 state->activity_.topState = true; 359 370 this->activeStates_.push_back(state); 360 371 } … … 362 373 void Game::unloadState(orxonox::GameState* state) 363 374 { 375 state->activity_.topState = false; 364 376 state->deactivate(); 365 377 this->activeStates_.pop_back(); 378 if (!this->activeStates_.empty()) 379 this->activeStates_.back()->activity_.topState = true; 366 380 } 367 381 368 382 /*static*/ bool Game::addGameState(GameState* state) 369 383 { 370 std::map<std::string, GameState*>::const_iterator it = allStates_s.find( state->getName());384 std::map<std::string, GameState*>::const_iterator it = allStates_s.find(getLowercase(state->getName())); 371 385 if (it == allStates_s.end()) 372 allStates_s[ state->getName()] = state;386 allStates_s[getLowercase(state->getName())] = state; 373 387 else 374 388 ThrowException(GameState, "Cannot add two GameStates with the same name to 'Game'.");
Note: See TracChangeset
for help on using the changeset viewer.