Changeset 1534 for code/trunk/src/network/GameStateManager.cc
- Timestamp:
- Jun 4, 2008, 8:53:10 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/network/GameStateManager.cc
r1505 r1534 44 44 #include <iostream> 45 45 #include <zlib.h> 46 #include <assert.h> 46 47 47 48 #include "core/CoreIncludes.h" … … 106 107 break; 107 108 if( (*it).second <= 0 ){ 108 COUT( 4) << "GameStateManager: deleting gamestate with id: " << (*it).first << ", uses: " << (*it).second << std::endl;109 COUT(5) << "GameStateManager: deleting gamestate with id: " << (*it).first << ", uses: " << (*it).second << std::endl; 109 110 std::map<int, GameState *>::iterator tempit = gameStateMap.find((*it).first); 110 111 if( tempit != gameStateMap.end() ){ … … 140 141 client = it->second; 141 142 GameState *server = reference; 142 COUT(4) << "client: " << client << " server: " << server << " gamestatemap: " << &gameStateMap << " size: " << server->size << std::endl; 143 //COUT(4) << "client: " << client << " server: " << server << " gamestatemap: " << &gameStateMap << " size: " << server->size << std::endl; 144 COUT(4) << "client: " << (client!=0 ? client->id : (int)client) << " server: " << server->id << " gamestatemap: " << &gameStateMap << " size: " << server->size << std::endl; 143 145 if(client) 144 146 return encode(client, server); … … 267 269 sync.data = data; 268 270 data+=sync.length; 269 COUT( 4) << "objectID: " << sync.objectID << " classID: " << sync.classID << std::endl;271 COUT(5) << "objectID: " << sync.objectID << " classID: " << sync.classID << std::endl; 270 272 while(it && it->objectID!=sync.objectID) 271 273 ++it; … … 319 321 320 322 GameStateCompressed *GameStateManager::encode(GameState *a, GameState *b) { 321 COUT( 4) << "G.St.Man: this will be a DIFFED gamestate" << std::endl;323 COUT(5) << "G.St.Man: this will be a DIFFED gamestate" << std::endl; 322 324 GameState *r = diff(a,b); 323 325 GameStateCompressed *c = compress_(r); … … 472 474 if(gamestateID == GAMESTATEID_INITIAL){ 473 475 temp->setGameStateID(GAMESTATEID_INITIAL); 474 if(curid!=GAMESTATEID_INITIAL) 476 if(curid!=GAMESTATEID_INITIAL){ 477 assert(gameStateUsed.find(curid)!=gameStateUsed.end()); 475 478 --(gameStateUsed.find(curid)->second); 479 } 476 480 return; 477 481 } … … 483 487 // deleteUnusedGameState(curid); 484 488 //increase gamestateused 485 if(curid!=GAMESTATEID_INITIAL) 486 --(gameStateUsed.find(curid)->second); 487 ++(gameStateUsed.find(gamestateID)->second); 488 temp->setGameStateID(gamestateID); 489 std::map<int, int>::iterator it = gameStateUsed.find(curid); 490 if(curid!=GAMESTATEID_INITIAL){ 491 if(it!=gameStateUsed.end()) 492 --(it->second); 493 } 494 it = gameStateUsed.find(gamestateID); 495 if(it!=gameStateUsed.end()){ 496 ++(it->second); 497 temp->setGameStateID(gamestateID); 498 } 489 499 /* 490 500 GameState *old = clientGameState[clientID];
Note: See TracChangeset
for help on using the changeset viewer.