Changeset 7730 for code/branches/masterserver/src/orxonox
- Timestamp:
- Dec 8, 2010, 3:05:07 PM (14 years ago)
- Location:
- code/branches/masterserver/src/orxonox/gamestates
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/masterserver/src/orxonox/gamestates/CMakeLists.txt
r6105 r7730 6 6 GSRoot.cc 7 7 GSServer.cc 8 GSMasterServer.cc 8 9 GSStandalone.cc 9 10 ) -
code/branches/masterserver/src/orxonox/gamestates/GSMasterServer.cc
r7727 r7730 31 31 32 32 #include "util/Debug.h" 33 #include "core/CommandLineParser.h"34 33 #include "core/Game.h" 35 34 #include "core/GameMode.h" 36 #include "network/Server.h"37 35 38 36 namespace orxonox 39 37 { 40 38 DeclareGameState(GSMasterServer, "masterserver", false, false); 41 39 42 SetCommandLineArgument(port, 55566).shortcut("p").information("Network communication port to be used 0-65535 (default: 55566)"); 40 GSMasterServer::GSMasterServer(const GameStateInfo& info) 41 : GameState(info) 42 { 43 43 44 GSMasterServer::GSMasterServer(const GameStateInfo& info) 45 : GameState(info) 46 , server_(0) 47 { 48 } 44 } 49 45 50 GSMasterServer::~GSMasterServer() 51 { 52 } 46 GSMasterServer::~GSMasterServer() 47 { 48 this->mserver->~MasterServer(); 49 } 53 50 54 void GSMasterServer::activate() 55 { 56 GameMode::setIsServer(true); 51 void GSMasterServer::activate() 52 { 53 /* TODO make this work for masterserver as well */ 54 //GameMode::setIsServer(true); 57 55 58 this->server_ = new Server(CommandLineParser::getValue("port"));59 COUT(0) << "Loading scene inserver mode" << std::endl;56 this->mserver = new MasterServer(); 57 COUT(0) << "Loading masterserver mode" << std::endl; 60 58 61 server_->open();62 59 this->mserver->run(); 60 } 63 61 64 void GSMasterServer::deactivate() 65 { 66 this->server_->close(); 67 delete this->server_; 62 void GSMasterServer::deactivate() 63 { /* nothing so far */ } 68 64 69 GameMode::setIsServer(false); 70 } 71 72 void GSMasterServer::update(const Clock& time) 73 { 74 server_->update(time); 75 } 65 void GSMasterServer::update(const Clock& time) 66 { /* nothing so far */ } 76 67 } -
code/branches/masterserver/src/orxonox/gamestates/GSMasterServer.h
r7727 r7730 35 35 #include "core/GameState.h" 36 36 #include "network/NetworkPrereqs.h" 37 #include "network/MasterServer.h" 37 38 38 39 namespace orxonox 39 40 { 40 41 41 class _OrxonoxExport GSMasterServer : public GameState 42 { 42 43 public: 43 44 44 GSMasterServer(const GameStateInfo& info); 45 ~GSMasterServer(); 45 46 46 47 48 47 void activate(); 48 void deactivate(); 49 void update(const Clock& time); 49 50 50 51 private: 51 52 }; 52 MasterServer *mserver; 53 54 55 }; 53 56 } 54 57
Note: See TracChangeset
for help on using the changeset viewer.