Changeset 1939 for code/branches/objecthierarchy/src/network
- Timestamp:
- Oct 18, 2008, 5:46:27 PM (16 years ago)
- Location:
- code/branches/objecthierarchy/src/network
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy/src/network/ClientConnectionListener.cc
r1938 r1939 1 1 #include "ClientConnectionListener.h" 2 2 #include "core/CoreIncludes.h" 3 #include "Settings.h" 3 4 4 5 namespace network{ … … 10 11 11 12 void ClientConnectionListener::getConnectedClients(){ 12 this->clientConnected(0); //server client id 13 if(orxonox::Settings::showsGraphics()) 14 this->clientConnected(0); //server client id 13 15 ClientInformation *client = ClientInformation::getBegin(); 14 16 while(client){ -
code/branches/objecthierarchy/src/network/ClientConnectionListener.h
r1938 r1939 10 10 class _NetworkExport ClientConnectionListener : public orxonox::OrxonoxClass 11 11 { 12 public: 12 13 ClientConnectionListener(); 13 14 -
code/branches/objecthierarchy/src/network/Server.cc
r1916 r1939 46 46 47 47 #include "ConnectionManager.h" 48 #include "ClientConnectionListener.h" 48 49 #include "GamestateManager.h" 49 50 #include "ClientInformation.h" … … 280 281 281 282 bool Server::addClient(ENetEvent *event){ 283 unsigned int newid=0; 284 282 285 ClientInformation *temp = ClientInformation::insertBack(new ClientInformation); 283 286 if(!temp){ … … 286 289 } 287 290 if(temp==ClientInformation::getBegin()) { //not good if you use anything else than insertBack 288 temp->setID(1);291 newid=1; 289 292 } 290 293 else 291 temp->setID(temp->prev()->getID()+1); 294 newid=temp->prev()->getID()+1; 295 temp->setID(newid); 292 296 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 293 304 COUT(3) << "Server: added client id: " << temp->getID() << std::endl; 294 return createClient(temp->getID()); 295 305 return createClient(temp->getID()); 306 } 296 307 297 308 bool Server::createClient(int clientID){ … … 329 340 return false; 330 341 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 331 349 return ClientInformation::removeClient(event->peer); 332 350 }
Note: See TracChangeset
for help on using the changeset viewer.