- Timestamp:
- Oct 21, 2008, 5:53:09 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy/src/network/GamestateManager.cc
r1962 r1990 65 65 } 66 66 67 bool GamestateManager::add(packet::Gamestate *gs, int clientID){67 bool GamestateManager::add(packet::Gamestate *gs, unsigned int clientID){ 68 68 assert(gs); 69 std::map< int, packet::Gamestate*>::iterator it = gamestateQueue.find(clientID);69 std::map<unsigned int, packet::Gamestate*>::iterator it = gamestateQueue.find(clientID); 70 70 if(it!=gamestateQueue.end()){ 71 71 // delete obsolete gamestate … … 77 77 78 78 bool GamestateManager::processGamestates(){ 79 std::map< int, packet::Gamestate*>::iterator it;79 std::map<unsigned int, packet::Gamestate*>::iterator it; 80 80 // now push only the most recent gamestates we received (ignore obsolete ones) 81 81 for(it = gamestateQueue.begin(); it!=gamestateQueue.end(); it++){ … … 126 126 }*/ 127 127 128 packet::Gamestate *GamestateManager::popGameState( int clientID) {128 packet::Gamestate *GamestateManager::popGameState(unsigned int clientID) { 129 129 //why are we searching the same client's gamestate id as we searched in 130 130 //Server::sendGameState? … … 141 141 packet::Gamestate *client=NULL; 142 142 if(gID != GAMESTATEID_INITIAL){ 143 std::map<unsigned int, std::map< int, packet::Gamestate*> >::iterator clientMap = gamestateMap_.find(clientID);143 std::map<unsigned int, std::map<unsigned int, packet::Gamestate*> >::iterator clientMap = gamestateMap_.find(clientID); 144 144 if(clientMap!=gamestateMap_.end()){ 145 std::map< int, packet::Gamestate*>::iterator it = clientMap->second.find(gID);145 std::map<unsigned int, packet::Gamestate*>::iterator it = clientMap->second.find(gID); 146 146 if(it!=clientMap->second.end()) 147 147 client = it->second; … … 162 162 163 163 164 bool GamestateManager::ack( int gamestateID,int clientID) {164 bool GamestateManager::ack(unsigned int gamestateID, unsigned int clientID) { 165 165 ClientInformation *temp = ClientInformation::findClient(clientID); 166 166 assert(temp); … … 172 172 } 173 173 174 assert(curid <gamestateID);174 assert(curid==(unsigned int)GAMESTATEID_INITIAL || curid<gamestateID); 175 175 COUT(4) << "acking gamestate " << gamestateID << " for clientid: " << clientID << " curid: " << curid << std::endl; 176 std::map< int, packet::Gamestate*>::iterator it, tempit;176 std::map<unsigned int, packet::Gamestate*>::iterator it, tempit; 177 177 for(it = gamestateMap_[clientID].begin(); it!=gamestateMap_[clientID].end() && it->first<gamestateID; it++){ 178 178 delete it->second; … … 186 186 void GamestateManager::removeClient(ClientInformation* client){ 187 187 assert(client); 188 std::map<unsigned int, std::map< int, packet::Gamestate*> >::iterator clientMap = gamestateMap_.find(client->getID());188 std::map<unsigned int, std::map<unsigned int, packet::Gamestate*> >::iterator clientMap = gamestateMap_.find(client->getID()); 189 189 // first delete all remained gamestates 190 std::map< int, packet::Gamestate*>::iterator it;190 std::map<unsigned int, packet::Gamestate*>::iterator it; 191 191 for(it=clientMap->second.begin(); it!=clientMap->second.end(); it++) 192 192 delete it->second;
Note: See TracChangeset
for help on using the changeset viewer.