Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 31, 2008, 6:07:57 PM (16 years ago)
Author:
rgrieder
Message:
  • renamed:

GameState —> GameStateBase
GameStateTyped<T> —> GameState

  • moved command line parsing from GSRoot to RootGameState.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/gui/src/core/RootGameState.cc

    r1688 r1689  
    3939
    4040    RootGameState::RootGameState(const std::string& name)
    41         : GameStateTyped<GameState>(name)
     41        : GameState<GameStateBase>(name)
    4242        , stateRequest_("")
    4343    {
     
    5353        the method can assume certain things to be granted (like 'this' is always active).
    5454    */
    55     void RootGameState::makeTransition(GameState* source, GameState* destination)
     55    void RootGameState::makeTransition(GameStateBase* source, GameStateBase* destination)
    5656    {
    5757        if (source != 0)
     
    6868
    6969        // Check for 'destination' in the children map first
    70         std::map<GameState*, GameState*>::const_iterator it
     70        std::map<GameStateBase*, GameStateBase*>::const_iterator it
    7171            = this->grandchildrenToChildren_.find(destination);
    7272        if (it != this->grandchildrenToChildren_.end())
    7373        {
    74             OrxAssert(dynamic_cast<GameState*>(it->second) != 0,
     74            OrxAssert(dynamic_cast<GameStateBase*>(it->second) != 0,
    7575                "There was a mix with RootGameState and GameState, could not cast.");
    76             GameState* child = static_cast<GameState*>(it->second);
     76            GameStateBase* child = static_cast<GameStateBase*>(it->second);
    7777            // child state. Don't use 'state', might be a grandchild!
    7878            this->activeChild_ = child;
     
    8888    void RootGameState::gotoState(const std::string& name)
    8989    {
    90         GameState* request = getState(name);
     90        GameStateBase* request = getState(name);
    9191        if (request)
    9292        {
    93             GameState* current = getCurrentState();
     93            GameStateBase* current = getCurrentState();
    9494            if (current)
    9595            {
     
    127127        State to start with (usually main menu or specified by command line)
    128128    */
    129     void RootGameState::start()
     129    void RootGameState::start(int argc, char** argv)
    130130    {
     131        parseCommandLine(argc, argv);
     132
    131133        this->activate();
    132134
     
    149151        this->deactivate();
    150152    }
     153
     154    void RootGameState::parseCommandLine(int argc, char** argv)
     155    {
     156        std::vector<std::string> args;
     157        for (int i = 1; i < argc; ++i)
     158            args.push_back(argv[i]);
     159
     160        try
     161        {
     162            orxonox::CommandLine::parse(args);
     163        }
     164        catch (orxonox::ArgumentException& ex)
     165        {
     166            COUT(1) << ex.what() << std::endl;
     167            COUT(0) << "Usage:" << std::endl << "orxonox " << CommandLine::getUsageInformation() << std::endl;
     168        }
     169    }
    151170}
Note: See TracChangeset for help on using the changeset viewer.