Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 25, 2009, 5:23:00 PM (15 years ago)
Author:
rgrieder
Message:

Implemented new GameState concept. It doesn't differ that much from the old one, but there's still lots of changes.
The most important change is that one GameState can occur multiple times in the hierarchy.

Short log:

  • No RootGameState anymore. Simply the highest is root.
  • Game::requestGameState(name) can refer to the parent, grandparent, great-grandparent, etc. or one of the children.
  • Requested states are saved. So if you select "level", the next request (even right after the call) will be relative to "level"
  • Game::popState() will simply unload the current one
  • Re added Main.cc again because Game as well as GameState have been moved to the core
  • Adapted all GameStates to the new system

Things should already work, except for network support because standalone only works with a little hack.
We can now start creating a better hierarchy.

File:
1 edited

Legend:

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

    r2817 r2844  
    3535#include "core/Core.h"
    3636#include "network/Client.h"
     37#include "core/Game.h"
    3738
    3839namespace orxonox
    3940{
     41    AddGameState(GSClient, "client");
     42
    4043    SetCommandLineArgument(ip, "127.0.0.1").information("#.#.#.#");
    4144
    42     GSClient::GSClient()
    43         : GameState("client")
     45    GSClient::GSClient(const std::string& name)
     46        : GameState(name)
    4447        , client_(0)
    4548    {
     
    5053    }
    5154
    52     void GSClient::enter()
     55    void GSClient::activate()
    5356    {
    5457        Core::setIsClient(true);
     
    5962            ThrowException(InitialisationFailed, "Could not establish connection with server.");
    6063
    61         GSLevel::enter();
    62 
    6364        client_->update(Core::getGameClock());
    6465    }
    6566
    66     void GSClient::leave()
     67    void GSClient::deactivate()
    6768    {
    68         GSLevel::leave();
    69 
    7069        client_->closeConnection();
    7170
     
    7675    }
    7776
    78     void GSClient::ticked(const Clock& time)
     77    void GSClient::update(const Clock& time)
    7978    {
    80         GSLevel::ticked(time);
    8179        client_->update(time);
    82 
    83         this->tickChild(time);
    8480    }
    8581}
Note: See TracChangeset for help on using the changeset viewer.