Changeset 1360 for code/trunk/src/network/GameStateClient.cc
- Timestamp:
- May 22, 2008, 2:02:06 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/network/GameStateClient.cc
r1293 r1360 47 47 COUT(5) << "this: " << this << std::endl; 48 48 last_diff_=0; 49 last_gamestate_=GAMESTATEID_INITIAL-1; 49 50 } 50 51 … … 56 57 printGameStateMap(); 57 58 GameState *gs, *reference; 59 /*if(compstate->id<last_gamestate_){ 60 // network packets got messed up 61 COUT(3) << "received an obsolete gamestate" << std::endl; 62 return false; 63 }*/ 58 64 if(compstate->diffed && compstate->base_id!=GAMESTATEID_INITIAL){ 59 65 std::map<int, GameState*>::iterator it = gameStateMap.find(compstate->base_id); … … 77 83 COUT(4) << "adding decoded gs with id: " << gs->id << " diffed from: " << gs->base_id << std::endl; 78 84 last_diff_=gs->base_id; 85 //last_gamestate_=gs->id; 79 86 return true; 80 87 }else{ … … 145 152 if(!id){ 146 153 COUT(4) << "We could not identify a new object; classid: " << sync.classID << std::endl; 147 continue;154 return false; 148 155 } 149 156 Synchronisable *no = dynamic_cast<Synchronisable *>(id->fabricate()); 150 157 COUT(4) << "loadsnapshot: classid: " << sync.classID << " objectID: " << sync.objectID << " length: " << sync.length << std::endl; 158 if(!no){ 159 COUT(2) << "coudl not frabricate classid: " << sync.classID << " objectID: " << sync.objectID << " identifier: " << id << std::endl; 160 break; 161 } 151 162 no->objectID=sync.objectID; 152 163 no->classID=sync.classID; 153 164 // update data and create object/entity... 154 if( !no->updateData(sync) ) 165 if( !no->updateData(sync) ){ 155 166 COUT(1) << "We couldn't update the object: " << sync.objectID << std::endl; 167 return false; 168 } 156 169 if( !no->create() ) 157 170 COUT(1) << "We couldn't manifest (create() ) the object: " << sync.objectID << std::endl; … … 349 362 COUT(4) << "using diffed gamestate" << std::endl; 350 363 GameState *t = decode(diff); 364 if(!t) 365 return NULL; 351 366 GameState *r = undiff(old, t); 352 367 delete[] t->data;
Note: See TracChangeset
for help on using the changeset viewer.