Changeset 2087 for code/trunk/src/orxonox/gamestates/GSServer.cc
- Timestamp:
- Nov 1, 2008, 7:04:09 PM (16 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/gamestates/GSServer.cc
r1910 r2087 30 30 #include "GSServer.h" 31 31 32 #include "core/ConsoleCommand.h"33 #include "core/input/InputManager.h"34 32 #include "core/CommandLine.h" 33 #include "core/Core.h" 35 34 #include "network/Server.h" 36 #include "Settings.h"37 35 38 36 namespace orxonox 39 37 { 40 SetCommandLineArgument(port, 55556).s etShortcut("p").setInformation("0-65535");38 SetCommandLineArgument(port, 55556).shortcut("p").information("0-65535"); 41 39 42 40 GSServer::GSServer() 43 : G SLevel("server")41 : GameState<GSGraphics>("server") 44 42 , server_(0) 45 43 { … … 52 50 void GSServer::enter() 53 51 { 54 Settings::_getInstance().bHasServer_ = true;52 Core::setHasServer(true); 55 53 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")); 60 55 COUT(0) << "Loading scene in server mode" << std::endl; 61 56 62 this->loadLevel();57 GSLevel::enter(this->getParent()->getViewport()); 63 58 64 59 server_->open(); 65 66 // add console commands67 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 input72 InputManager::getInstance().requestEnterState("game");73 60 } 74 61 75 62 void GSServer::leave() 76 63 { 77 InputManager::getInstance().requestLeaveState("game"); 78 79 // TODO: Remove and destroy console command 80 81 this->unloadLevel(); 64 GSLevel::leave(); 82 65 83 66 this->server_->close(); 84 67 delete this->server_; 85 68 86 GSLevel::leave(); 87 88 Settings::_getInstance().bHasServer_ = false; 69 Core::setHasServer(false); 89 70 } 90 71
Note: See TracChangeset
for help on using the changeset viewer.