Changeset 1690
- Timestamp:
- Aug 31, 2008, 8:39:13 PM (16 years ago)
- Location:
- code/branches/gui/src/core
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gui/src/core/CommandLine.cc
r1664 r1690 28 28 29 29 #include "CommandLine.h" 30 31 #include "util/String.h" 30 32 31 33 namespace orxonox … … 108 110 109 111 // save old data first 112 value = removeTrailingWhitespaces(value); 110 113 if (name != "") 111 114 { … … 152 155 153 156 // parse last argument 157 value = removeTrailingWhitespaces(value); 154 158 if (name != "") 155 159 { -
code/branches/gui/src/core/GameState.cc
r1689 r1690 59 59 GameStateBase::~GameStateBase() 60 60 { 61 OrxAssert( !isInSubtree(getCurrentState()), "Deleting an active GameState is a very bad idea..");61 OrxAssert(this->operation_.active == false, "Deleting an active GameState is a very bad idea.."); 62 62 } 63 63 -
code/branches/gui/src/core/GameState.h
r1689 r1690 139 139 { 140 140 public: 141 GameState(const std::string& name) : GameStateBase(name) { } 141 GameState(const std::string& name) 142 : GameStateBase(name) 143 , parent_(0) 144 { } 142 145 virtual ~GameState() { } 143 146 -
code/branches/gui/src/core/RootGameState.cc
r1689 r1690 29 29 #include "RootGameState.h" 30 30 31 #include "util/String.h" 32 #include "util/SubString.h" 31 33 #include "Clock.h" 32 34 #include "Debug.h" … … 129 131 void RootGameState::start(int argc, char** argv) 130 132 { 131 parse CommandLine(argc, argv);133 parseArguments(argc, argv); 132 134 133 135 this->activate(); … … 152 154 } 153 155 154 void RootGameState::parseCommandLine(int argc, char** argv) 155 { 156 /** 157 @brief 158 Parses both command line and start.ini for CommandLineArguments. 159 */ 160 void RootGameState::parseArguments(int argc, char** argv) 161 { 162 // parse command line first 156 163 std::vector<std::string> args; 157 164 for (int i = 1; i < argc; ++i) … … 167 174 COUT(0) << "Usage:" << std::endl << "orxonox " << CommandLine::getUsageInformation() << std::endl; 168 175 } 176 177 // look for additional arguments in start.ini 178 std::ifstream file; 179 file.open("start.ini"); 180 args.clear(); 181 if (file) 182 { 183 while (!file.eof()) 184 { 185 std::string line; 186 std::getline(file, line); 187 line = removeTrailingWhitespaces(line); 188 //if (!(line[0] == '#' || line[0] == '%')) 189 //{ 190 SubString tokens(line, " ", " ", false, 92, false, 34, false, 40, 41, false, '#'); 191 for (unsigned i = 0; i < tokens.size(); ++i) 192 if (tokens[i][0] != '#') 193 args.push_back(tokens[i]); 194 //args.insert(args.end(), tokens.getAllStrings().begin(), tokens.getAllStrings().end()); 195 //} 196 } 197 file.close(); 198 } 199 200 try 201 { 202 orxonox::CommandLine::parse(args); 203 } 204 catch (orxonox::ArgumentException& ex) 205 { 206 COUT(1) << "An Exception occured while parsing start.ini" << std::endl; 207 COUT(1) << ex.what() << std::endl; 208 COUT(0) << "Usage:" << std::endl << "orxonox " << CommandLine::getUsageInformation() << std::endl; 209 } 169 210 } 170 211 } -
code/branches/gui/src/core/RootGameState.h
r1689 r1690 48 48 void gotoState(const std::string& name); 49 49 50 void parse CommandLine(int argc, char** argv);50 void parseArguments(int argc, char** argv); 51 51 52 52 std::string stateRequest_;
Note: See TracChangeset
for help on using the changeset viewer.