Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 25, 2009, 5:23:00 PM (16 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/GSDedicated.cc

    r2817 r2844  
    3737#include "objects/Tickable.h"
    3838#include "util/Sleep.h"
     39#include "core/Game.h"
    3940
    4041namespace orxonox
    4142{
    42     GSDedicated::GSDedicated()
    43         : GameState("dedicated")
     43    AddGameState(GSDedicated, "dedicated");
     44
     45    GSDedicated::GSDedicated(const std::string& name)
     46        : GameState(name)
    4447        , server_(0)
    4548        , timeSinceLastUpdate_(0)
     
    5154    }
    5255
    53     void GSDedicated::enter()
     56    void GSDedicated::activate()
    5457    {
    5558        Core::setHasServer(true);
     
    5861        COUT(0) << "Loading scene in server mode" << std::endl;
    5962
    60         GSLevel::enter();
    61 
    6263        server_->open();
    6364    }
    6465
    65     void GSDedicated::leave()
     66    void GSDedicated::deactivate()
    6667    {
    67         GSLevel::leave();
    68 
    6968        this->server_->close();
    7069        delete this->server_;
     
    7372    }
    7473
    75     void GSDedicated::ticked(const Clock& time)
     74    void GSDedicated::update(const Clock& time)
    7675    {
    7776//        static float startTime = time.getSecondsPrecise();
     
    8382//            COUT(0) << "estimated ticks/sec: " << nrOfTicks/(time.getSecondsPrecise()-startTime) << endl;
    8483            timeSinceLastUpdate_ -= static_cast<unsigned int>(timeSinceLastUpdate_ / NETWORK_PERIOD) * NETWORK_PERIOD;
    85             GSLevel::ticked(time);
    8684            server_->update(time);
    87             this->tickChild(time);
    8885        }
    8986        else
Note: See TracChangeset for help on using the changeset viewer.