[Gcblue-commits] gcb_wx/src/network tcUpdateMessageHandler.cpp,1.7,1.8
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2004-05-08 22:20:39
|
Update of /cvsroot/gcblue/gcb_wx/src/network In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28993/src/network Modified Files: tcUpdateMessageHandler.cpp Log Message: Index: tcUpdateMessageHandler.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcUpdateMessageHandler.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcUpdateMessageHandler.cpp 8 May 2004 21:25:26 -0000 1.7 --- tcUpdateMessageHandler.cpp 8 May 2004 22:20:29 -0000 1.8 *************** *** 57,61 **** stream << obj->mnID; // write id ! *obj >> stream; } --- 57,78 ---- stream << obj->mnID; // write id ! ! /** ! * A temporary stream is created so that the size of the ! * obj update can be written before the data to allow ! * skipping over when the client doesn't have the obj created ! * yet. There may be a way to write a temp value for ! * size, keep a reference to the pos in the stream, and update ! * the value. This would avoid copying the entire update. ! */ ! tcCommandStream temp; ! ! *obj >> temp; ! ! unsigned int updateSize = temp.size(); ! ! stream << updateSize; ! ! stream << temp; } *************** *** 104,109 **** stream << obj->mnID; // write id ! // write obj state to stream ! *obj >> stream; } --- 121,141 ---- stream << obj->mnID; // write id ! /** ! * A temporary stream is created so that the size of the ! * obj update can be written before the data to allow ! * skipping over when the client doesn't have the obj created ! * yet. There may be a way to write a temp value for ! * size, keep a reference to the pos in the stream, and update ! * the value. This would avoid copying the entire update. ! */ ! tcUpdateStream temp; ! ! *obj >> temp; ! ! unsigned int updateSize = temp.size(); ! ! stream << updateSize; ! ! stream << temp; } *************** *** 296,299 **** --- 328,334 ---- while ((stream >> id).eof() == false) { + unsigned int updateSize; + stream >> updateSize; + // lookup obj tcGameObject* obj = simState->GetObject(id); *************** *** 311,316 **** else { ! fprintf(stdout, "%d (unknown)\n", id); ! return; } } --- 346,352 ---- else { ! stream.skip(updateSize); ! ! fprintf(stdout, "%d(X) ", id); } } *************** *** 486,489 **** --- 522,528 ---- while ((stream >> id).eof() == false) { + unsigned int updateSize; + stream >> updateSize; + // lookup obj tcGameObject* obj = simState->GetObject(id); *************** *** 498,504 **** { missingIds.push(id); ! fprintf(stderr, "Error - HandleUpdate - obj %d not found\n", id); ! fprintf(stdout, "\n"); ! return; } } --- 537,542 ---- { missingIds.push(id); ! fprintf(stdout, "%d(X) ", id); ! stream.skip(updateSize); } } |