Changeset 1939 for code/branches/objecthierarchy/src/network/Server.cc
- Timestamp:
- Oct 18, 2008, 5:46:27 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.