Changeset 1690 for code/branches/gui/src/core/RootGameState.cc
- Timestamp:
- Aug 31, 2008, 8:39:13 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note: See TracChangeset
for help on using the changeset viewer.