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/GSServer.cc

    r2817 r2844  
    3333#include "core/Core.h"
    3434#include "network/Server.h"
     35#include "core/Game.h"
    3536
    3637namespace orxonox
    3738{
     39    AddGameState(GSServer, "server");
     40
    3841    SetCommandLineArgument(port, 55556).shortcut("p").information("0-65535");
    3942
    40     GSServer::GSServer()
    41         : GameState("server")
     43    GSServer::GSServer(const std::string& name)
     44        : GameState(name)
    4245        , server_(0)
    4346    {
     
    4851    }
    4952
    50     void GSServer::enter()
     53    void GSServer::activate()
    5154    {
    5255        Core::setHasServer(true);
     
    5558        COUT(0) << "Loading scene in server mode" << std::endl;
    5659
    57         GSLevel::enter();
    58 
    5960        server_->open();
    6061    }
    6162
    62     void GSServer::leave()
     63    void GSServer::deactivate()
    6364    {
    64         GSLevel::leave();
    65 
    6665        this->server_->close();
    6766        delete this->server_;
     
    7069    }
    7170
    72     void GSServer::ticked(const Clock& time)
     71    void GSServer::update(const Clock& time)
    7372    {
    74         GSLevel::ticked(time);
    7573        server_->update(time);
    76         this->tickChild(time);
    7774    }
    7875}
Note: See TracChangeset for help on using the changeset viewer.