Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 20, 2008, 10:30:28 PM (16 years ago)
Author:
rgrieder
Message:

Added CommandLine class.
You can now call SetCommandLineArgument like SetConsoleCommand and hereby define a new command line argument. They are passed in main() and then they can be accessed by commandLine::getCommandLineArgument().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/gui/src/orxonox/gamestates/GSRoot.cc

    r1662 r1663  
    3838#include "core/TclBind.h"
    3939#include "core/Core.h"
     40#include "core/CommandLine.h"
    4041#include "GraphicsEngine.h"
    4142#include "Settings.h"
     
    4344namespace orxonox
    4445{
     46    SetCommandLineArgument(dataPath, std::string("./"));
     47
    4548    GSRoot::GSRoot()
    4649        : GameState("root")
     50        , settings_(0)
    4751        , graphicsEngine_(0)
    4852    {
     
    6468        Factory::createClassHierarchy();
    6569
    66         const Settings::CommandLineArgument* dataPath = Settings::getCommandLineArgument("dataPath");
    67         assert(dataPath);
    68         if (!dataPath->bHasDefaultValue_)
     70        // instantiate Settings class
     71        this->settings_ = new Settings();
     72
     73        const CommandLineArgument<std::string>* dataPath = CommandLine::getCommandLineArgument<std::string>("dataPath");
     74        if (!dataPath->hasDefaultValue())
    6975        {
    70             if (*dataPath->value_.getString().end() != '/' && *dataPath->value_.getString().end() != '\\')
    71                 Settings::tsetDataPath(dataPath->value_.getString() + "/");
     76            if (*dataPath->getValue().end() != '/' && *dataPath->getValue().end() != '\\')
     77                Settings::tsetDataPath(dataPath->getValue() + "/");
    7278            else
    73                 Settings::tsetDataPath(dataPath->value_.getString());
     79                Settings::tsetDataPath(dataPath->getValue());
    7480        }
    7581
     
    8995    void GSRoot::leave()
    9096    {
    91         if (this->graphicsEngine_)
    92             delete graphicsEngine_;
     97        delete graphicsEngine_;
     98
     99        delete settings_;
    93100    }
    94101
Note: See TracChangeset for help on using the changeset viewer.