Changeset 1751 for code/trunk/src/network/GamestateManager.cc
- Timestamp:
- Sep 9, 2008, 4:31:34 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/network/GamestateManager.cc
r1735 r1751 129 129 //why are we searching the same client's gamestate id as we searched in 130 130 //Server::sendGameState? 131 packet::Gamestate *gs; 131 132 int gID = ClientInformation::findClient(clientID)->getGamestateID(); 132 COUT(4) << "G.St.Man: popgamestate: sending gstate_id: " << id_ << " diffed from: " << gID << std::endl; 133 // COUT(3) << "gamestatemap: " << &gameStateMap << std::endl; 133 //COUT(4) << "G.St.Man: popgamestate: sending gstate_id: " << id_ << " diffed from: " << gID << std::endl; 134 134 //chose wheather the next gamestate is the first or not 135 135 if(gID != GAMESTATEID_INITIAL){ 136 // TODO something with the gamestatemap is wrong137 136 packet::Gamestate *client=NULL; 138 137 std::map<int, packet::Gamestate*>::iterator it = gamestateMap.find(gID); 139 138 if(it!=gamestateMap.end()) 140 139 client = it->second; 141 packet::Gamestate *gs;142 140 if(client) 143 141 gs = reference->diff(client); 144 142 else 145 143 gs = new packet::Gamestate(*reference); 146 gs->compressData();147 return gs;148 144 } else { 149 145 COUT(4) << "we got a GAMESTATEID_INITIAL for clientID: " << clientID << std::endl; 150 // ackGameState(clientID, reference->id);151 return new packet::Gamestate(*reference);152 // return an undiffed gamestate and set appropriate flags153 }146 gs = new packet::Gamestate(*reference); 147 } 148 assert(gs->compressData()); 149 return gs; 154 150 } 155 151 … … 194 190 if(client->getGamestateID()>=0) 195 191 gamestateUsed[client->getGamestateID()]--; 196 ClientInformation::removeClient(client->getID());197 192 } 198 193 199 194 bool GamestateManager::processGamestate(packet::Gamestate *gs){ 200 assert(gs->decompressData()); 195 if(gs->isCompressed()) 196 assert(gs->decompressData()); 201 197 assert(!gs->isDiffed()); 202 198 return gs->spreadData();
Note: See TracChangeset
for help on using the changeset viewer.