Changeset 1005 for code/branches/network/src/network/GameStateClient.cc
- Timestamp:
- Apr 9, 2008, 8:38:52 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/network/src/network/GameStateClient.cc
r984 r1005 33 33 namespace network 34 34 { 35 struct GameStateItem{ 36 GameState *state; 37 int id; 38 }; 39 35 40 GameStateClient::GameStateClient() { 36 41 } … … 41 46 bool GameStateClient::pushGameState(GameStateCompressed *compstate) { 42 47 GameState *gs; 43 if(compstate->diffed) 44 gs = decode(reference, compstate); 48 if(compstate->diffed){ 49 while(compstate->base_id > gameStateList.front()->id){ 50 // clean up old gamestates 51 free(gameStateList.front()->data); 52 // TODO: critical section 53 delete gameStateList.front(); 54 gameStateList.pop(); 55 } 56 if(compstate->base_id!=gameStateList.front()->id){ 57 COUT(4) << "pushGameState: no reference found to diff" << std::endl; 58 return false; 59 } 60 gs = decode(gameStateList.front(), compstate); 61 } 45 62 else 46 63 gs = decode(compstate); … … 197 214 GameState *GameStateClient::decode(GameState *a, GameStateCompressed *x) { 198 215 GameState *t = decompress(x); 216 gameStateList.push(t); 199 217 return undiff(a, t); 200 218 } … … 202 220 GameState *GameStateClient::decode(GameStateCompressed *x) { 203 221 GameState *t = decompress(x); 222 gameStateList.push(t); 204 223 return t; 205 224 }
Note: See TracChangeset
for help on using the changeset viewer.