Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 21, 2008, 5:53:09 PM (16 years ago)
Author:
scheusso
Message:
  • some adjustments in client handling (we use unsigned int as id now everywhere)
  • fixed a problem with clientinformation
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchy/src/network/GamestateManager.cc

    r1962 r1990  
    6565  }
    6666
    67   bool GamestateManager::add(packet::Gamestate *gs, int clientID){
     67  bool GamestateManager::add(packet::Gamestate *gs, unsigned int clientID){
    6868    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);
    7070    if(it!=gamestateQueue.end()){
    7171      // delete obsolete gamestate
     
    7777
    7878  bool GamestateManager::processGamestates(){
    79     std::map<int, packet::Gamestate*>::iterator it;
     79    std::map<unsigned int, packet::Gamestate*>::iterator it;
    8080    // now push only the most recent gamestates we received (ignore obsolete ones)
    8181    for(it = gamestateQueue.begin(); it!=gamestateQueue.end(); it++){
     
    126126  }*/
    127127
    128   packet::Gamestate *GamestateManager::popGameState(int clientID) {
     128  packet::Gamestate *GamestateManager::popGameState(unsigned int clientID) {
    129129    //why are we searching the same client's gamestate id as we searched in
    130130    //Server::sendGameState?
     
    141141    packet::Gamestate *client=NULL;
    142142    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);
    144144      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);
    146146        if(it!=clientMap->second.end())
    147147          client = it->second;
     
    162162
    163163
    164   bool GamestateManager::ack(int gamestateID, int clientID) {
     164  bool GamestateManager::ack(unsigned int gamestateID, unsigned int clientID) {
    165165    ClientInformation *temp = ClientInformation::findClient(clientID);
    166166    assert(temp);
     
    172172    }
    173173
    174     assert(curid<gamestateID);
     174    assert(curid==(unsigned int)GAMESTATEID_INITIAL || curid<gamestateID);
    175175    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;
    177177    for(it = gamestateMap_[clientID].begin(); it!=gamestateMap_[clientID].end() && it->first<gamestateID; it++){
    178178      delete it->second;
     
    186186  void GamestateManager::removeClient(ClientInformation* client){
    187187    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());
    189189    // first delete all remained gamestates
    190     std::map<int, packet::Gamestate*>::iterator it;
     190    std::map<unsigned int, packet::Gamestate*>::iterator it;
    191191    for(it=clientMap->second.begin(); it!=clientMap->second.end(); it++)
    192192      delete it->second;
Note: See TracChangeset for help on using the changeset viewer.