Changeset 1775 for code/branches/network/src/network/Server.cc
- Timestamp:
- Sep 12, 2008, 5:36:57 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/network/src/network/Server.cc
r1755 r1775 56 56 #include "packet/Packet.h" 57 57 #include "packet/Welcome.h" 58 #include "packet/DeleteObjects.h" 58 59 #include <util/Convert.h> 59 60 … … 229 230 //std::cout << "updated gamestate, sending it" << std::endl; 230 231 //if(clients->getGamestateID()!=GAMESTATEID_INITIAL) 232 sendObjectDeletes(); 231 233 sendGameState(); 232 234 COUT(5) << "Server: one sendGameState turn complete, repeat in next tick" << std::endl; … … 276 278 // gs gets automatically deleted by enet callback 277 279 } 278 /*if(added) {279 //std::cout << "send gamestates from server.cc in sendGameState" << std::endl;280 return connection->sendPackets();281 }*/282 //COUT(5) << "Server: had no gamestates to send" << std::endl;283 280 return true; 284 281 } 285 282 283 bool Server::sendObjectDeletes(){ 284 ClientInformation *temp = ClientInformation::getBegin(); 285 packet::DeleteObjects *del = new packet::DeleteObjects(); 286 if(!del->fetchIDs()) 287 return true; //everything ok (no deletes this tick) 288 while(temp != NULL){ 289 if( !(temp->getSynched()) ){ 290 COUT(5) << "Server: not sending gamestate" << std::endl; 291 temp=temp->next(); 292 continue; 293 } 294 int cid = temp->getID(); //get client id 295 packet::DeleteObjects *cd = new packet::DeleteObjects(*del); 296 assert(cd); 297 cd->setClientID(cid); 298 if ( !cd->send() ) 299 COUT(3) << "Server: packet with client id (cid): " << cid << " not sended: " << temp->getFailures() << std::endl; 300 temp=temp->next(); 301 // gs gets automatically deleted by enet callback 302 } 303 return true; 304 } 305 286 306 // void Server::processChat( chat *data, int clientId){ 287 307 // char *message = new char [strlen(data->message)+10+1];
Note: See TracChangeset
for help on using the changeset viewer.