Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 27, 2009, 2:42:37 PM (15 years ago)
Author:
rgrieder
Message:

Moved startup argument parsing (console, dedicated, server, client and standalone) from GSRoot.cc to Main.cc.
This allows to finally prevent GameState request while loading/unloading them (changed the code in Game.cc to enforce this).

Location:
code/branches/resource/src/orxonox/gamestates
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/resource/src/orxonox/gamestates/GSGraphics.cc

    r3357 r3358  
    6868        masterInputState_ = InputManager::getInstance().createInputState("master", true);
    6969        masterKeyBinder_ = new KeyBinder();
     70        masterInputState_->setKeyHandler(masterKeyBinder_);
    7071    }
    7172
     
    99100
    100101        masterKeyBinder_->loadBindings("masterKeybindings.ini");
    101         masterInputState_->setKeyHandler(masterKeyBinder_);
    102102
    103103        // Load the SoundManager
  • code/branches/resource/src/orxonox/gamestates/GSRoot.cc

    r3355 r3358  
    3030
    3131#include "core/Clock.h"
    32 #include "core/CommandLine.h"
    3332#include "core/ConsoleCommand.h"
    3433#include "core/Game.h"
     
    4645{
    4746    DeclareGameState(GSRoot, "root", false, false);
    48     SetCommandLineSwitch(console).information("Start in console mode (text IO only)");
    49     // Shortcuts for easy direct loading
    50     SetCommandLineSwitch(server).information("Start in server mode");
    51     SetCommandLineSwitch(client).information("Start in client mode");
    52     SetCommandLineSwitch(dedicated).information("Start in dedicated server mode");
    53     SetCommandLineSwitch(standalone).information("Start in standalone mode");
    5447
    5548    GSRoot::GSRoot(const GameStateInfo& info)
     
    9588        // create the global LevelManager
    9689        this->levelManager_ = new LevelManager();
    97 
    98         // Load level directly?
    99         bool loadLevel = false;
    100         if (CommandLine::getValue("standalone").getBool())
    101         {
    102             Game::getInstance().requestStates("graphics, standalone, level");
    103             loadLevel = true;
    104         }
    105         if (CommandLine::getValue("server").getBool())
    106         {
    107             Game::getInstance().requestStates("graphics, server, level");
    108             loadLevel = true;
    109         }
    110         if (CommandLine::getValue("client").getBool())
    111         {
    112             Game::getInstance().requestStates("graphics, client, level");
    113             loadLevel = true;
    114         }
    115         if (CommandLine::getValue("dedicated").getBool())
    116         {
    117             Game::getInstance().requestStates("dedicated, level");
    118             loadLevel = true;
    119         }
    120        
    121         // Determine where to start otherwise
    122         if (!loadLevel && !CommandLine::getValue("console").getBool())
    123         {
    124             // Also load graphics
    125             Game::getInstance().requestState("graphics");
    126         }
    12790    }
    12891
Note: See TracChangeset for help on using the changeset viewer.