Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 2, 2008, 12:22:42 AM (16 years ago)
Author:
rgrieder
Message:

Merged r2101 (objecthierarchy) to trunk.

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/trunk/src/orxonox/Main.cc

    r2087 r2103  
    4242#include "util/SignalHandler.h"
    4343#include "core/ConfigFileManager.h"
     44#include "core/CommandLine.h"
    4445
    4546#include "gamestates/GSRoot.h"
     
    5152#include "gamestates/GSGUI.h"
    5253#include "gamestates/GSIOConsole.h"
    53 
    54 using namespace orxonox;
    5554
    5655#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_APPLE
     
    8685//#endif
    8786
     87SetCommandLineArgument(settingsFile, "orxonox.ini");
     88
    8889int main(int argc, char** argv)
    8990{
     91    using namespace orxonox;
     92
    9093    // create a signal handler (only works for linux)
    9194    SignalHandler::getInstance()->doCatch(argv[0], "orxonox.log");
    9295
    93     // Specifiy config file before creating the GameStates in order to have
     96    // Parse command line arguments
     97    try
     98    {
     99        CommandLine::parseAll(argc, argv);
     100    }
     101    catch (ArgumentException& ex)
     102    {
     103        COUT(1) << ex.what() << std::endl;
     104        COUT(0) << "Usage:" << std::endl << "orxonox " << CommandLine::getUsageInformation() << std::endl;
     105    }
     106
     107    // Create the ConfigFileManager before creating the GameStates in order to have
    94108    // setConfigValues() in the constructor (required).
    95     ConfigFileManager::getInstance().setFile(CFT_Settings, "orxonox.ini");
     109    ConfigFileManager* configFileManager = new ConfigFileManager();
     110    configFileManager->setFilename(ConfigFileType::Settings, CommandLine::getValue("settingsFile").getString());
    96111
    97112    // create the gamestates
     
    115130
    116131    // Here happens the game
    117     root.start(argc, argv);
     132    root.start();
     133
     134    // Destroy ConfigFileManager again.
     135    delete configFileManager;
    118136
    119137    return 0;
Note: See TracChangeset for help on using the changeset viewer.