Changeset 1574 for code/branches/core3/src/network/Server.cc
- Timestamp:
- Jun 9, 2008, 4:35:38 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core3/src/network/Server.cc
r1556 r1574 57 57 #define MAX_FAILURES 20; 58 58 #define NETWORK_FREQUENCY 30 59 59 60 60 Server *Server::instance_=0; 61 61 62 62 Server *Server::createSingleton(){ 63 63 if(!instance_) … … 80 80 return instance_; 81 81 } 82 82 83 83 Server *Server::getSingleton(){ 84 84 return instance_; 85 85 } 86 87 86 87 88 88 /** 89 89 * Constructor for default values (bindaddress is set to ENET_HOST_ANY … … 97 97 gamestates = new GameStateManager(clients); 98 98 } 99 99 100 100 Server::Server(int port){ 101 101 timeSinceLastUpdate_=0; … … 217 217 if(clients->findClient(&event->peer->address)){ 218 218 clientID = clients->findClient(&event->peer->address)->getID(); 219 if( !elaborate(event->packet, clientID) ) 219 if( !elaborate(event->packet, clientID) ) 220 220 COUT(3) << "Server: could not elaborate" << std::endl; 221 221 } … … 276 276 continue; 277 277 if ( !(connection->addPacket(packet, cid)) ){ 278 COUT(3) << "Server: packet with client id (cid): " << cid << " not sended: " << temp->getFailures() << std::endl; 278 COUT(3) << "Server: packet with client id (cid): " << cid << " not sended: " << temp->getFailures() << std::endl; 279 279 temp->addFailure(); 280 280 /*if(temp->getFailures() > 0 ) … … 302 302 delete data; 303 303 } 304 304 305 305 bool Server::processConnectRequest( connectRequest *con, int clientID ){ 306 306 //(COUT(3) << "processing connectRequest " << std::endl; … … 310 310 return true; 311 311 } 312 312 313 313 void Server::processGamestate( GameStateCompressed *data, int clientID){ 314 314 COUT(4) << "processing partial gamestate from client " << clientID << std::endl; … … 319 319 clients->findClient(clientID)->resetFailures();*/ 320 320 } 321 321 322 322 void Server::processChat( chat *data, int clientId){ 323 323 char *message = new char [strlen(data->message)+10+1]; … … 329 329 delete data; 330 330 } 331 331 332 332 bool Server::addClient(ENetEvent *event){ 333 333 ClientInformation *temp = clients->insertBack(new ClientInformation); … … 346 346 return createClient(temp->getID()); 347 347 } 348 348 349 349 bool Server::createClient(int clientID){ 350 350 ClientInformation *temp = clients->findClient(clientID); … … 366 366 return true; 367 367 } 368 368 369 369 bool Server::createShip(ClientInformation *client){ 370 370 if(!client) … … 390 390 no->classID = id->getNetworkID(); 391 391 no->create(); 392 392 393 393 client->setShipID(no->objectID); 394 394 return true; 395 395 } 396 396 397 397 bool Server::disconnectClient(ENetEvent *event){ 398 398 COUT(4) << "removing client from list" << std::endl; 399 399 //return removeClient(head_->findClient(&(peer->address))->getID()); 400 400 401 401 //boost::recursive_mutex::scoped_lock lock(head_->mutex_); 402 orxonox::Iterator<orxonox::SpaceShip> it = orxonox::ObjectList<orxonox::SpaceShip>:: start();402 orxonox::Iterator<orxonox::SpaceShip> it = orxonox::ObjectList<orxonox::SpaceShip>::begin(); 403 403 ClientInformation *client = clients->findClient(&event->peer->address); 404 404 if(!client) … … 426 426 gamestates->removeClient(client); 427 427 } 428 428 429 429 }
Note: See TracChangeset
for help on using the changeset viewer.