Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 14, 2011, 3:43:41 PM (14 years ago)
Author:
smerkli
Message:

Generic witty commit comment

Location:
code/branches/masterserver2/src/libraries/network
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/masterserver2/src/libraries/network/MasterServer.cc

    r8204 r8241  
    2929#include "MasterServer.h"
    3030#include "util/ScopedSingletonManager.h"
     31#include "core/command/ConsoleCommand.h"
    3132#include "core/CoreIncludes.h"
    3233#include "core/CorePrereqs.h"
     
    3435namespace orxonox
    3536{
     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
    3665  /* helpers */
    3766  static void
     
    332361    this->peers = new PeerList();
    333362
     363    /* set pointer to this instance */
     364    MasterServer::setInstance( this );
     365
    334366    /* tell people we're now initialized */
    335367    COUT(0) << "MasterServer initialized, waiting for connections.\n";
     
    343375    enet_host_destroy( this->server );
    344376
    345     /* free all used memory */
     377    /* TODO free all used memory */
    346378    /* clear the list of connected game servers */
    347379    /* clear the list of connected game clients */
  • code/branches/masterserver2/src/libraries/network/MasterServer.h

    r8204 r8241  
    6161      int run();
    6262
     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
    6373    private:
    6474      /* methods */
Note: See TracChangeset for help on using the changeset viewer.