Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 1, 2008, 7:04:09 PM (16 years ago)
Author:
landauf
Message:

merged objecthierarchy branch back to trunk

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/gamestates/GSServer.cc

    r1910 r2087  
    3030#include "GSServer.h"
    3131
    32 #include "core/ConsoleCommand.h"
    33 #include "core/input/InputManager.h"
    3432#include "core/CommandLine.h"
     33#include "core/Core.h"
    3534#include "network/Server.h"
    36 #include "Settings.h"
    3735
    3836namespace orxonox
    3937{
    40     SetCommandLineArgument(port, 55556).setShortcut("p").setInformation("0-65535");
     38    SetCommandLineArgument(port, 55556).shortcut("p").information("0-65535");
    4139
    4240    GSServer::GSServer()
    43         : GSLevel("server")
     41        : GameState<GSGraphics>("server")
    4442        , server_(0)
    4543    {
     
    5250    void GSServer::enter()
    5351    {
    54         Settings::_getInstance().bHasServer_ = true;
     52        Core::setHasServer(true);
    5553
    56         GSLevel::enter();
    57 
    58         int serverPort = CommandLine::getArgument<int>("port")->getValue();
    59         this->server_ = new network::Server(serverPort);
     54        this->server_ = new network::Server(CommandLine::getValue("port"));
    6055        COUT(0) << "Loading scene in server mode" << std::endl;
    6156
    62         this->loadLevel();
     57        GSLevel::enter(this->getParent()->getViewport());
    6358
    6459        server_->open();
    65 
    66         // add console commands
    67         FunctorMember<GSLevel>* functor = createFunctor(&GSLevel::setTimeFactor);
    68         functor->setObject(this);
    69         CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(functor, "setTimeFactor")).accessLevel(AccessLevel::Offline).defaultValue(0, 1.0);;
    70 
    71         // level is loaded: we can start capturing the input
    72         InputManager::getInstance().requestEnterState("game");
    7360    }
    7461
    7562    void GSServer::leave()
    7663    {
    77         InputManager::getInstance().requestLeaveState("game");
    78 
    79         // TODO: Remove and destroy console command
    80 
    81         this->unloadLevel();
     64        GSLevel::leave();
    8265
    8366        this->server_->close();
    8467        delete this->server_;
    8568
    86         GSLevel::leave();
    87        
    88         Settings::_getInstance().bHasServer_ = false;
     69        Core::setHasServer(false);
    8970    }
    9071
Note: See TracChangeset for help on using the changeset viewer.