Changeset 1689 for code/branches/gui/src/core/RootGameState.cc
- Timestamp:
- Aug 31, 2008, 6:07:57 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gui/src/core/RootGameState.cc
r1688 r1689 39 39 40 40 RootGameState::RootGameState(const std::string& name) 41 : GameState Typed<GameState>(name)41 : GameState<GameStateBase>(name) 42 42 , stateRequest_("") 43 43 { … … 53 53 the method can assume certain things to be granted (like 'this' is always active). 54 54 */ 55 void RootGameState::makeTransition(GameState * source, GameState* destination)55 void RootGameState::makeTransition(GameStateBase* source, GameStateBase* destination) 56 56 { 57 57 if (source != 0) … … 68 68 69 69 // Check for 'destination' in the children map first 70 std::map<GameState *, GameState*>::const_iterator it70 std::map<GameStateBase*, GameStateBase*>::const_iterator it 71 71 = this->grandchildrenToChildren_.find(destination); 72 72 if (it != this->grandchildrenToChildren_.end()) 73 73 { 74 OrxAssert(dynamic_cast<GameState *>(it->second) != 0,74 OrxAssert(dynamic_cast<GameStateBase*>(it->second) != 0, 75 75 "There was a mix with RootGameState and GameState, could not cast."); 76 GameState * child = static_cast<GameState*>(it->second);76 GameStateBase* child = static_cast<GameStateBase*>(it->second); 77 77 // child state. Don't use 'state', might be a grandchild! 78 78 this->activeChild_ = child; … … 88 88 void RootGameState::gotoState(const std::string& name) 89 89 { 90 GameState * request = getState(name);90 GameStateBase* request = getState(name); 91 91 if (request) 92 92 { 93 GameState * current = getCurrentState();93 GameStateBase* current = getCurrentState(); 94 94 if (current) 95 95 { … … 127 127 State to start with (usually main menu or specified by command line) 128 128 */ 129 void RootGameState::start( )129 void RootGameState::start(int argc, char** argv) 130 130 { 131 parseCommandLine(argc, argv); 132 131 133 this->activate(); 132 134 … … 149 151 this->deactivate(); 150 152 } 153 154 void RootGameState::parseCommandLine(int argc, char** argv) 155 { 156 std::vector<std::string> args; 157 for (int i = 1; i < argc; ++i) 158 args.push_back(argv[i]); 159 160 try 161 { 162 orxonox::CommandLine::parse(args); 163 } 164 catch (orxonox::ArgumentException& ex) 165 { 166 COUT(1) << ex.what() << std::endl; 167 COUT(0) << "Usage:" << std::endl << "orxonox " << CommandLine::getUsageInformation() << std::endl; 168 } 169 } 151 170 }
Note: See TracChangeset
for help on using the changeset viewer.