Changeset 2087 for code/trunk/src/orxonox/gamestates/GSClient.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/GSClient.cc
r1907 r2087 32 32 #include "core/input/InputManager.h" 33 33 #include "core/CommandLine.h" 34 #include "core/Core.h" 34 35 #include "network/Client.h" 35 #include "Settings.h"36 36 37 37 namespace orxonox 38 38 { 39 SetCommandLineArgument(ip, "127.0.0.1"). setInformation("#.#.#.#");39 SetCommandLineArgument(ip, "127.0.0.1").information("#.#.#.#"); 40 40 41 41 GSClient::GSClient() 42 : G SLevel("client")42 : GameState<GSGraphics>("client") 43 43 , client_(0) 44 44 { … … 51 51 void GSClient::enter() 52 52 { 53 Settings::_getInstance().bIsClient_ = true;53 Core::setIsClient(true); 54 54 55 GSLevel::enter(); 56 57 int serverPort = CommandLine::getArgument<int>("port")->getValue(); 58 std::string serverIP = CommandLine::getArgument<std::string>("ip")->getValue(); 59 this->client_ = new network::Client(serverIP, serverPort); 55 this->client_ = new network::Client(CommandLine::getValue("ip").getString(), CommandLine::getValue("port")); 60 56 61 57 if(!client_->establishConnection()) 62 58 ThrowException(InitialisationFailed, "Could not establish connection with server."); 63 59 60 GSLevel::enter(this->getParent()->getViewport()); 61 64 62 client_->tick(0); 65 66 // level is loaded: we can start capturing the input67 InputManager::getInstance().requestEnterState("game");68 63 } 69 64 70 65 void GSClient::leave() 71 66 { 72 InputManager::getInstance().requestLeaveState("game"); 73 74 // TODO: How do we unload the level in client mode? 67 GSLevel::leave(); 75 68 76 69 client_->closeConnection(); … … 79 72 delete this->client_; 80 73 81 GSLevel::leave(); 82 83 Settings::_getInstance().bIsClient_ = false; 74 Core::setIsClient(false); 84 75 } 85 76
Note: See TracChangeset
for help on using the changeset viewer.