Changeset 1200
- Timestamp:
- Apr 28, 2008, 11:39:23 PM (17 years ago)
- Location:
- code/branches/network3/src/network
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/network3/src/network/GameStateClient.cc
r1199 r1200 133 133 orxonox::Identifier* id = ID((unsigned int)sync.classID); 134 134 if(!id){ 135 COUT(4) << "We could not identify a new object "<< std::endl;135 COUT(4) << "We could not identify a new object; classid: " << sync.classID << std::endl; 136 136 continue; 137 137 } … … 192 192 r->id = diff->id; 193 193 r->size = dest_length; 194 r->base_id = diff->base_id;194 r->base_id = old->id; 195 195 r->diffed = false; 196 196 r->data = dp; … … 236 236 gamestate->size = normsize; 237 237 gamestate->data = dest; 238 gamestate->base_id = a->base_id; 238 239 gamestate->diffed = a->diffed; 239 240 … … 252 253 253 254 GameState *GameStateClient::decode(GameStateCompressed *x) { 254 //GameState *t = decompress(x);255 GameState *t = new GameState;255 GameState *t = decompress(x); 256 /*GameState *t = new GameState; 256 257 t->base_id = x->base_id; 257 258 t->id = x->id; 258 259 t->diffed = x->diffed; 259 260 t->data = x->data; 260 t->size = x->normsize; 261 t->size = x->normsize;*/ 261 262 return t; 262 263 } -
code/branches/network3/src/network/GameStateManager.cc
r1199 r1200 79 79 std::map<int,int>::iterator it = gameStateUsed.begin(); 80 80 while(it!=gameStateUsed.end()){ 81 if((id_-(*it).first)<KEEP_GAMESTATES) 82 break; 81 83 if( (*it).second <= 0 ){ 82 84 COUT(4) << "GameStateManager: deleting gamestate with id: " << (*it).first << ", uses: " << (*it).second << std::endl; … … 86 88 gameStateUsed.erase(it++); 87 89 continue; 88 } else if(id_-it->first<=KEEP_GAMESTATES){ //as soon as we got a used gamestate break here because we could use newer gamestates in future but only if we do not exceed KEEP_GAMESTATES # of gamestates in cache90 }/*else if(id_-it->first<=KEEP_GAMESTATES){ //as soon as we got a used gamestate break here because we could use newer gamestates in future but only if we do not exceed KEEP_GAMESTATES # of gamestates in cache 89 91 COUT(4) << "breaking " << std::endl; 90 92 break; 91 } 93 }*/ 92 94 it++; 93 95 } … … 114 116 COUT(4) << "we got a GAMESTATEID_INITIAL for clientID: " << clientID << std::endl; 115 117 GameState *server = reference; 116 ackGameState(clientID, reference->id);118 // ackGameState(clientID, reference->id); 117 119 //head_->findClient(clientID)->setGamestateID(id); 118 120 return encode(server); … … 203 205 204 206 GameStateCompressed *GameStateManager::encode(GameState *a, GameState *b) { 205 COUT( 5) << "G.St.Man: this will be a DIFFED gamestate" << std::endl;207 COUT(4) << "G.St.Man: this will be a DIFFED gamestate" << std::endl; 206 208 GameState *r = diff(a,b); 207 //r.diffed = true;209 // r->diffed = true; 208 210 // GameState *r = b; 209 211 // r->diffed = false; 210 //return compress_(r);211 GameStateCompressed *g = new GameStateCompressed;212 return compress_(r); 213 /*GameStateCompressed *g = new GameStateCompressed; 212 214 g->base_id = r->base_id; 213 215 g->id = r->id; … … 216 218 g->normsize = r->size; 217 219 g->compsize = r->size; 218 return g ;220 return g*/; 219 221 } 220 222 221 223 GameStateCompressed *GameStateManager::encode(GameState *a) { 222 COUT(5) << "G.St.Man: this will be a not diffed gamestate" << std::endl;223 a->diffed=false;224 GameStateCompressed *g = new GameStateCompressed;224 COUT(5) << "G.St.Man: encoding gamestate (compress)" << std::endl; 225 return compress_(a); 226 /*GameStateCompressed *g = new GameStateCompressed; 225 227 g->base_id = a->base_id; 226 228 g->id = a->id; … … 229 231 g->normsize = a->size; 230 232 g->compsize = a->size; 231 return g; 233 return g;*/ 232 234 } 233 235 -
code/branches/network3/src/network/GameStateManager.h
r1199 r1200 50 50 { 51 51 52 #define KEEP_GAMESTATES 10 052 #define KEEP_GAMESTATES 10 53 53 54 54 /**
Note: See TracChangeset
for help on using the changeset viewer.