Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 28, 2009, 2:55:47 AM (15 years ago)
Author:
landauf
Message:

Changes in ClientConnectionListener:

  • Added static functions for connect/disconnect which notify all instances
  • getConnectedClients() also returned client "0" which is the ID of the server. This is important for the PlayerManager, but other classes (like for example TrafficControl) don't use getConnectedClients(), so I assumed I can safely remove this line. The 0-client gets now connected and disconnected in GSLevel (which also creates and destroys the PlayerManager). If the 0-client is also needed by other classes, I suggest moving it into the network.

The instance of HumanPlayer is now deleted if GSLevel gets deactivated. This also destroys the default HUD.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core5/src/libraries/network/Server.cc

    r5749 r5820  
    279279
    280280    // inform all the listeners
    281     ObjectList<ClientConnectionListener>::iterator listener = ObjectList<ClientConnectionListener>::begin();
    282     while(listener){
    283       listener->clientConnected(newid);
    284       listener++;
    285     }
     281    ClientConnectionListener::broadcastClientConnected(newid);
    286282
    287283    ++newid;
     
    329325    ServerConnection::disconnectClient( client );
    330326    GamestateManager::removeClient(client);
    331 // inform all the listeners
    332     ObjectList<ClientConnectionListener>::iterator listener = ObjectList<ClientConnectionListener>::begin();
    333     while(listener){
    334       listener->clientDisconnected(client->getID());
    335       ++listener;
    336     }
     327    // inform all the listeners
     328    ClientConnectionListener::broadcastClientDisconnected(client->getID());
     329
    337330    delete client; //remove client from list
    338331  }
Note: See TracChangeset for help on using the changeset viewer.