- Timestamp:
- Oct 27, 2008, 10:56:51 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy/src/orxonox/gamestates/GSServer.cc
r2003 r2023 30 30 #include "GSServer.h" 31 31 32 #include "core/ConsoleCommand.h"33 #include "core/input/InputManager.h"34 32 #include "core/CommandLine.h" 35 33 #include "core/Core.h" … … 41 39 42 40 GSServer::GSServer() 43 : G SLevel("server")41 : GameState<GSGraphics>("server") 44 42 , server_(0) 45 43 { … … 54 52 Core::setHasServer(true); 55 53 56 GSLevel::enter();57 58 54 this->server_ = new network::Server(CommandLine::getValue("port")); 59 55 COUT(0) << "Loading scene in server mode" << std::endl; 60 56 61 this->loadLevel();57 GSLevel::enter(this->getParent()->getViewport()); 62 58 63 59 server_->open(); 64 65 // add console commands66 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 input71 InputManager::getInstance().requestEnterState("game");72 60 } 73 61 74 62 void GSServer::leave() 75 63 { 76 InputManager::getInstance().requestLeaveState("game"); 77 78 // TODO: Remove and destroy console command 79 80 this->unloadLevel(); 64 GSLevel::leave(); 81 65 82 66 this->server_->close(); 83 67 delete this->server_; 84 85 GSLevel::leave();86 68 87 69 Core::setHasServer(false);
Note: See TracChangeset
for help on using the changeset viewer.