Changeset 8241 for code/branches/masterserver2/src
- Timestamp:
- Apr 14, 2011, 3:43:41 PM (14 years ago)
- Location:
- code/branches/masterserver2/src/libraries/network
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/masterserver2/src/libraries/network/MasterServer.cc
r8204 r8241 29 29 #include "MasterServer.h" 30 30 #include "util/ScopedSingletonManager.h" 31 #include "core/command/ConsoleCommand.h" 31 32 #include "core/CoreIncludes.h" 32 33 #include "core/CorePrereqs.h" … … 34 35 namespace orxonox 35 36 { 37 /* commands for the terminal interface */ 38 SetConsoleCommand( "ms-listservers", &MasterServer::listServers ); 39 40 MasterServer *MasterServer::instance = NULL; 41 42 /* command: list servers */ 43 void 44 MasterServer::listServers( void ) 45 { 46 /* get an iterator */ 47 std::list<ServerListElem>::iterator i; 48 49 /* print list header */ 50 COUT(0) << "List of connected servers" << std::endl; 51 52 /* loop through list elements */ 53 for( i = MasterServer::getInstance()->mainlist.serverlist.begin(); 54 i != MasterServer::getInstance()->mainlist.serverlist.end(); ++i ) 55 { 56 COUT(0) << " " << (*i).ServerInfo.getServerIP() << std::endl; 57 } 58 59 /* display end of list */ 60 COUT(0) << MasterServer::getInstance()->mainlist.serverlist.size() << 61 " servers connected." << std::endl; 62 } 63 64 36 65 /* helpers */ 37 66 static void … … 332 361 this->peers = new PeerList(); 333 362 363 /* set pointer to this instance */ 364 MasterServer::setInstance( this ); 365 334 366 /* tell people we're now initialized */ 335 367 COUT(0) << "MasterServer initialized, waiting for connections.\n"; … … 343 375 enet_host_destroy( this->server ); 344 376 345 /* free all used memory */377 /* TODO free all used memory */ 346 378 /* clear the list of connected game servers */ 347 379 /* clear the list of connected game clients */ -
code/branches/masterserver2/src/libraries/network/MasterServer.h
r8204 r8241 61 61 int run(); 62 62 63 /* static pointer for commands */ 64 static MasterServer *instance; 65 static MasterServer *getInstance() 66 { return instance; } 67 static void setInstance( MasterServer *setto ) 68 { instance = setto; } 69 70 /* functions for commands */ 71 static void listServers( void ); 72 63 73 private: 64 74 /* methods */
Note: See TracChangeset
for help on using the changeset viewer.