Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 27, 2008, 10:56:51 PM (16 years ago)
Author:
rgrieder
Message:
  • Added support for dedicated server. Could not network test it yet, client still segfaults me.
  • Also kicked GraphicsEngine::levelSceneManager_, there are only the statistic methods left.
  • GSDedicated also derives from GSLevel, but GSLevel is not anymore a real GameState.
  • CameraHandler and LevelManager get created in GSLevel now.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchy/src/orxonox/gamestates/GSServer.cc

    r2003 r2023  
    3030#include "GSServer.h"
    3131
    32 #include "core/ConsoleCommand.h"
    33 #include "core/input/InputManager.h"
    3432#include "core/CommandLine.h"
    3533#include "core/Core.h"
     
    4139
    4240    GSServer::GSServer()
    43         : GSLevel("server")
     41        : GameState<GSGraphics>("server")
    4442        , server_(0)
    4543    {
     
    5452        Core::setHasServer(true);
    5553
    56         GSLevel::enter();
    57 
    5854        this->server_ = new network::Server(CommandLine::getValue("port"));
    5955        COUT(0) << "Loading scene in server mode" << std::endl;
    6056
    61         this->loadLevel();
     57        GSLevel::enter(this->getParent()->getViewport());
    6258
    6359        server_->open();
    64 
    65         // add console commands
    66         FunctorMember<GSLevel>* functor = createFunctor(&GSLevel::setTimeFactor);
    67         functor->setObject(this);
    68         CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(functor, "setTimeFactor")).accessLevel(AccessLevel::Offline).defaultValue(0, 1.0);;
    69 
    70         // level is loaded: we can start capturing the input
    71         InputManager::getInstance().requestEnterState("game");
    7260    }
    7361
    7462    void GSServer::leave()
    7563    {
    76         InputManager::getInstance().requestLeaveState("game");
    77 
    78         // TODO: Remove and destroy console command
    79 
    80         this->unloadLevel();
     64        GSLevel::leave();
    8165
    8266        this->server_->close();
    8367        delete this->server_;
    84 
    85         GSLevel::leave();
    8668
    8769        Core::setHasServer(false);
Note: See TracChangeset for help on using the changeset viewer.