Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1939


Ignore:
Timestamp:
Oct 18, 2008, 5:46:27 PM (16 years ago)
Author:
scheusso
Message:

forgot some things

Location:
code/branches/objecthierarchy/src/network
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchy/src/network/ClientConnectionListener.cc

    r1938 r1939  
    11#include "ClientConnectionListener.h"
    22#include "core/CoreIncludes.h"
     3#include "Settings.h"
    34
    45namespace network{
     
    1011
    1112  void ClientConnectionListener::getConnectedClients(){
    12     this->clientConnected(0); //server client id
     13    if(orxonox::Settings::showsGraphics())
     14      this->clientConnected(0); //server client id
    1315    ClientInformation *client = ClientInformation::getBegin();
    1416    while(client){
  • code/branches/objecthierarchy/src/network/ClientConnectionListener.h

    r1938 r1939  
    1010  class _NetworkExport ClientConnectionListener : public orxonox::OrxonoxClass
    1111  {
     12  public:
    1213    ClientConnectionListener();
    1314
  • code/branches/objecthierarchy/src/network/Server.cc

    r1916 r1939  
    4646
    4747#include "ConnectionManager.h"
     48#include "ClientConnectionListener.h"
    4849#include "GamestateManager.h"
    4950#include "ClientInformation.h"
     
    280281
    281282  bool Server::addClient(ENetEvent *event){
     283    unsigned int newid=0;
     284   
    282285    ClientInformation *temp = ClientInformation::insertBack(new ClientInformation);
    283286    if(!temp){
     
    286289    }
    287290    if(temp==ClientInformation::getBegin()) { //not good if you use anything else than insertBack
    288       temp->setID(1);
     291      newid=1;
    289292    }
    290293    else
    291       temp->setID(temp->prev()->getID()+1);
     294      newid=temp->prev()->getID()+1;
     295    temp->setID(newid);
    292296    temp->setPeer(event->peer);
     297   
     298    // inform all the listeners
     299    orxonox::ObjectList<ClientConnectionListener>::iterator listener = orxonox::ObjectList<ClientConnectionListener>::begin();
     300    while(listener){
     301      listener->clientConnected(newid);
     302    }
     303   
    293304    COUT(3) << "Server: added client id: " << temp->getID() << std::endl;
    294     return createClient(temp->getID());
    295   }
     305    return createClient(temp->getID()); 
     306}
    296307
    297308  bool Server::createClient(int clientID){
     
    329340      return false;
    330341    gamestates_->removeClient(client);
     342
     343// inform all the listeners
     344    orxonox::ObjectList<ClientConnectionListener>::iterator listener = orxonox::ObjectList<ClientConnectionListener>::begin();
     345    while(listener){
     346      listener->clientDisconnected(client->getID());
     347    }
     348
    331349    return ClientInformation::removeClient(event->peer);
    332350  }
Note: See TracChangeset for help on using the changeset viewer.