Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 9, 2008, 4:31:34 PM (17 years ago)
Author:
scheusso
Message:

merged network branch back into trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/network/GamestateManager.cc

    r1735 r1751  
    129129    //why are we searching the same client's gamestate id as we searched in
    130130    //Server::sendGameState?
     131    packet::Gamestate *gs;
    131132    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;
    134134    //chose wheather the next gamestate is the first or not
    135135    if(gID != GAMESTATEID_INITIAL){
    136       // TODO something with the gamestatemap is wrong
    137136      packet::Gamestate *client=NULL;
    138137      std::map<int, packet::Gamestate*>::iterator it = gamestateMap.find(gID);
    139138      if(it!=gamestateMap.end())
    140139        client = it->second;
    141       packet::Gamestate *gs;
    142140      if(client)
    143141        gs = reference->diff(client);
    144142      else
    145143        gs = new packet::Gamestate(*reference);
    146       gs->compressData();
    147       return gs;
    148144    } else {
    149145      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 flags
    153     }
     146      gs = new packet::Gamestate(*reference);
     147    }
     148    assert(gs->compressData());
     149    return gs;
    154150  }
    155151 
     
    194190    if(client->getGamestateID()>=0)
    195191      gamestateUsed[client->getGamestateID()]--;
    196     ClientInformation::removeClient(client->getID());
    197192  }
    198193 
    199194  bool GamestateManager::processGamestate(packet::Gamestate *gs){
    200     assert(gs->decompressData());
     195    if(gs->isCompressed())
     196       assert(gs->decompressData());
    201197    assert(!gs->isDiffed());
    202198    return gs->spreadData();
Note: See TracChangeset for help on using the changeset viewer.