Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 27, 2015, 10:45:56 AM (9 years ago)
Author:
maxima
Message:

multiplayer branch merged to presentation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentationFS15/src/libraries/network/PeerList.cc

    r8858 r10497  
    3838  PeerList::~PeerList() { }
    3939
    40   int 
     40  int
    4141  PeerList::addPeer( ENetPeer *toadd )
    4242  { /* error correction */
    43     if( toadd == NULL ) 
     43    if( toadd == NULL )
    4444    { orxout(internal_error, context::master_server) << "PeerList::addPeer: empty peer given." << endl;
    4545      return -1;
     
    5252
    5353  bool sub_compAddr( ENetAddress addr1, ENetAddress addr2 )
    54   { 
     54  {
    5555    for( int i = 0; i < 16; ++i )
    5656      if( addr1.host.addr[i] < addr2.host.addr[i] )
     
    6161    return 0;
    6262  }
    63    
     63
    6464
    6565  bool
     
    6969
    7070    /* loop through list elements */
    71     for( i = peerlist.begin(); i != peerlist.end(); ++i ) 
     71    for( i = peerlist.begin(); i != peerlist.end(); ++i )
    7272      if( !sub_compAddr((*i)->address, addr ) )
    7373      { /* found this name, remove and quit */
     
    8686
    8787    /* loop through list elements */
    88     for( i = peerlist.begin(); i != peerlist.end(); ++i ) 
     88    for( i = peerlist.begin(); i != peerlist.end(); ++i )
    8989      if( !sub_compAddr((*i)->address, addr ) )
    9090        /* found this name, remove and quit */
     
    9595  }
    9696
     97  int
     98  PeerList::count(){
     99    return this->peerlist.size();
     100  }
     101
    97102}
    98 
Note: See TracChangeset for help on using the changeset viewer.