Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 19, 2008, 12:09:01 AM (16 years ago)
Author:
scheusso
Message:

Some fixes in gamestate generation and handling (especially when no
objects are present)

Location:
code/branches/objecthierarchy/src/network
Files:
3 edited

Legend:

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

    r1940 r1944  
    102102  packet::Gamestate *GamestateClient::getGamestate(){
    103103    packet::Gamestate *gs = new packet::Gamestate();
    104     gs->collectData(0);
     104    if(!gs->collectData(0)){
     105      delete gs;
     106      return 0;
     107    }
    105108    return gs;
    106109  }
  • code/branches/objecthierarchy/src/network/GamestateManager.cc

    r1907 r1944  
    9191  bool GamestateManager::getSnapshot(){
    9292    reference = new packet::Gamestate();
    93     reference->collectData(++id_);
    94     //COUT(4) << "inserting gamestate: " << reference << std::endl;
    95     //gamestateMap_.insert(std::pair<int, packet::Gamestate*>(id_, reference));
    96 //     gamestateUsed[id_]=0;
     93    if(!reference->collectData(++id_)){ //we have no data to send
     94      delete reference;
     95      reference=0;
     96    }
    9797    return true;
    9898  }
     
    131131    packet::Gamestate *gs;
    132132    int gID = ClientInformation::findClient(clientID)->getGamestateID();
     133    if(!reference)
     134      return 0;
    133135    gs = reference->doSelection(clientID);
    134136//     gs = new packet::Gamestate(*reference);
  • code/branches/objecthierarchy/src/network/Server.cc

    r1942 r1944  
    239239      if(gs==NULL){
    240240        COUT(2) << "Server: could not generate gamestate (NULL from compress)" << std::endl;
     241        temp = temp->next();
    241242        continue;
    242243      }
     
    324325    g->setClientID(temp->getID());
    325326    b = g->collectData(0);
    326     assert(b);
     327    if(!b)
     328      return false; //no data for the client
    327329    b = g->compressData();
    328330    assert(b);
Note: See TracChangeset for help on using the changeset viewer.