Changeset 2799 for code/branches/gui/src/orxonox/Main.cc
- Timestamp:
- Mar 18, 2009, 9:15:39 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gui/src/orxonox/Main.cc
r2716 r2799 34 34 35 35 #include "OrxonoxStableHeaders.h" 36 #include "OrxonoxConfig.h" 36 37 37 38 #include <exception> 38 39 #include <cassert> 39 40 40 #include "OrxonoxConfig.h"41 41 #include "util/Debug.h" 42 #include "util/SignalHandler.h" 43 #include "core/ConfigFileManager.h" 44 #include "core/CommandLine.h" 45 #include "core/CommandExecutor.h" 42 #include "core/Core.h" 46 43 #include "core/Identifier.h" 47 #include "core/Core.h"48 #include "core/Language.h"49 44 50 45 #include "gamestates/GSRoot.h" … … 85 80 86 81 87 SetCommandLineArgument(settingsFile, "orxonox.ini");88 SetCommandLineArgument(configFileDirectory, "");89 82 90 83 int main(int argc, char** argv) 91 84 { 92 using namespace orxonox; 93 94 // Parse command line arguments 95 try 85 orxonox::Core* core = new orxonox::Core(argc, argv); 86 if (!core->isLoaded()) 96 87 { 97 CommandLine::parseAll(argc, argv); 88 COUT(0) << "Core was not fully loaded, probably an exception occurred during consruction. Aborting" << std::endl; 89 abort(); 98 90 } 99 catch (ArgumentException& ex)100 {101 COUT(1) << ex.what() << std::endl;102 COUT(0) << "Usage:" << std::endl << "orxonox " << CommandLine::getUsageInformation() << std::endl;103 }104 105 // Do this after parsing the command line to allow customisation106 Core::postMainInitialisation();107 108 // create a signal handler (only active for linux)109 SignalHandler signalHandler;110 signalHandler.doCatch(argv[0], Core::getLogPathString() + "orxonox_crash.log");111 112 // Create the ConfigFileManager before creating the GameStates in order to have113 // setConfigValues() in the constructor (required).114 ConfigFileManager* configFileManager = new ConfigFileManager();115 configFileManager->setFilename(ConfigFileType::Settings, CommandLine::getValue("settingsFile").getString());116 // create the Core settings to configure the output level117 Language* language = new Language();118 Core* core = new Core();119 91 120 92 // put GameStates in its own scope so we can destroy the identifiers at the end of main(). 121 93 { 94 using namespace orxonox; 122 95 // create the gamestates 123 96 GSRoot root; … … 143 116 } 144 117 145 // destroy singletons118 // Destroy pretty much everyhting left 146 119 delete core; 147 delete language;148 delete configFileManager;149 120 150 121 // Clean up class hierarchy stuff (identifiers, xmlport, configvalue, consolecommand) 151 Identifier::destroyAllIdentifiers(); 152 // destroy command line arguments 153 CommandLine::destroyAllArguments(); 154 // Also delete external console command that don't belong to an Identifier 155 CommandExecutor::destroyExternalCommands(); 122 // Needs to be done after 'delete core' because of ~OrxonoxClass 123 orxonox::Identifier::destroyAllIdentifiers(); 156 124 157 125 return 0;
Note: See TracChangeset
for help on using the changeset viewer.