Changeset 1663 for code/branches/gui/src/orxonox/Main.cc
- Timestamp:
- Aug 20, 2008, 10:30:28 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gui/src/orxonox/Main.cc
r1661 r1663 39 39 40 40 #include "util/OrxonoxPlatform.h" 41 #include "util/ArgReader.h"42 41 #include "core/SignalHandler.h" 43 42 #include "core/Debug.h" 44 #include "network/ClientConnection.h" 45 #include "Settings.h" 46 #include "Orxonox.h" 43 #include "core/CommandLine.h" 44 //#include "Orxonox.h" 47 45 48 46 #include "gamestates/GSRoot.h" … … 80 78 #endif 81 79 82 bool parseCommandLine(int argc, char** argv)83 {84 ArgReader args;85 std::string errorStr = args.parse(argc, argv);86 if (errorStr != "")87 {88 COUT(1) << "Command Line: Parsing failed.\n" << errorStr << std::endl;89 return false;90 }91 92 // Argument reader parses the command line to check syntax.93 // Settings Singleton then stores the arguments. It always94 // expects a default value.95 bool success = true;96 success &= Settings::addCommandLineArgument<std::string>97 ("mode", args.getArgument("mode"), "standalone");98 success &= Settings::addCommandLineArgument<std::string>99 ("dataPath", args.getArgument("dataPath"), "./");100 success &= Settings::addCommandLineArgument<std::string>101 ("ip", args.getArgument("ip"), "127.0.0.0");102 success &= Settings::addCommandLineArgument<int>103 ("port", args.getArgument("port"), NETWORK_PORT);104 105 if (!success)106 return false;107 108 if (!args.allChecked())109 {110 COUT(1) << "Command Line: Parsing failed.\nNot all arguments were matched." << std::endl;111 return false;112 }113 114 return true;115 }116 117 #include "core/GameState.h"118 80 119 81 #ifdef __cplusplus … … 123 85 int main(int argc, char** argv) 124 86 { 87 try 88 { 89 orxonox::CommandLine::parse(argc, argv); 90 } 91 catch (orxonox::ArgumentException& ex) 92 { 93 COUT(1) << ex.what() << std::endl; 94 COUT(0) << "Usage:" << std::endl << "orxonox [--mode client|server|dedicated|standalone] " 95 << "[--data PATH] [--ip IP] [--port PORT]" << std::endl; 96 } 97 98 125 99 // create a signal handler (only works for linux) 126 100 SignalHandler::getInstance()->doCatch(argv[0], "orxonox.log"); 127 101 128 if (!parseCommandLine(argc, argv))129 {130 COUT(0) << "Usage:" << std::endl << "orxonox [--mode client|server|dedicated|standalone] "131 << "[--data PATH] [--ip IP] [--port PORT]" << std::endl;132 return 0;133 }134 102 135 103 … … 181 149 182 150 183 Orxonox orxonoxInstance;151 //Orxonox orxonoxInstance; 184 152 185 153 try
Note: See TracChangeset
for help on using the changeset viewer.