Changeset 1747 for code/trunk/src/network/Server.cc
- Timestamp:
- Sep 9, 2008, 4:25:52 AM (16 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/core3 (added) merged: 1573-1574,1583-1586,1591-1594,1596-1597,1603,1606-1607,1610-1611,1655,1658,1676-1679,1681-1685,1687,1716-1723,1725-1729,1736
- Property svn:mergeinfo changed
-
code/trunk/src/network/Server.cc
r1735 r1747 50 50 #include "objects/SpaceShip.h" 51 51 #include "core/ConsoleCommand.h" 52 #include "core/Iterator.h" 52 53 #include "packet/Chat.h" 53 54 #include "packet/Packet.h" … … 58 59 #define MAX_FAILURES 20; 59 60 #define NETWORK_FREQUENCY 30 60 61 61 62 /** 62 63 * Constructor for default values (bindaddress is set to ENET_HOST_ANY … … 68 69 gamestates_ = new GamestateManager(); 69 70 } 70 71 71 72 Server::Server(int port){ 72 73 timeSinceLastUpdate_=0; … … 123 124 return message->process(); 124 125 } 125 126 126 127 /** 127 128 * This function sends out a message to all clients … … 175 176 return; 176 177 } 177 178 178 179 bool Server::queuePacket(ENetPacket *packet, int clientID){ 179 180 return connection->addPacket(packet, clientID); … … 230 231 return p->process(); 231 232 } 232 233 233 234 /** 234 235 * sends the gamestate … … 261 262 assert(gs->compressData()); 262 263 if ( !gs->send() ){ 263 COUT(3) << "Server: packet with client id (cid): " << cid << " not sended: " << temp->getFailures() << std::endl; 264 COUT(3) << "Server: packet with client id (cid): " << cid << " not sended: " << temp->getFailures() << std::endl; 264 265 temp->addFailure(); 265 266 }else … … 276 277 return true; 277 278 } 278 279 279 280 // void Server::processChat( chat *data, int clientId){ 280 281 // char *message = new char [strlen(data->message)+10+1]; … … 286 287 // delete data; 287 288 // } 288 289 289 290 bool Server::addClient(ENetEvent *event){ 290 291 ClientInformation *temp = ClientInformation::insertBack(new ClientInformation); … … 303 304 return createClient(temp->getID()); 304 305 } 305 306 306 307 bool Server::createClient(int clientID){ 307 308 ClientInformation *temp = ClientInformation::findClient(clientID); … … 325 326 return true; 326 327 } 327 328 328 329 bool Server::createShip(ClientInformation *client){ 329 330 if(!client) … … 351 352 no->create(); 352 353 no->setBacksync(true); 353 354 354 355 return true; 355 356 } 356 357 357 358 bool Server::disconnectClient(ENetEvent *event){ 358 359 COUT(4) << "removing client from list" << std::endl; 359 360 //return removeClient(head_->findClient(&(peer->address))->getID()); 360 361 361 362 //boost::recursive_mutex::scoped_lock lock(head_->mutex_); 362 orxonox:: Iterator<orxonox::SpaceShip> it = orxonox::ObjectList<orxonox::SpaceShip>::start();363 orxonox::ObjectList<orxonox::SpaceShip>::iterator it = orxonox::ObjectList<orxonox::SpaceShip>::begin(); 363 364 ClientInformation *client = ClientInformation::findClient(&event->peer->address); 364 365 if(!client) … … 369 370 continue; 370 371 } 371 orxonox:: Iterator<orxonox::SpaceShip>temp=it;372 orxonox::ObjectList<orxonox::SpaceShip>::iterator temp=it; 372 373 ++it; 373 374 delete *temp; … … 386 387 gamestates_->removeClient(client); 387 388 } 388 389 389 390 }
Note: See TracChangeset
for help on using the changeset viewer.