Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 19, 2010, 9:41:57 PM (14 years ago)
Author:
scheusso
Message:

some fixes
reactivating acking and gamestate diffing

File:
1 edited

Legend:

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

    r7777 r7780  
    110110      bool b = processGamestate(it->second);
    111111      assert(b);
     112      sendAck( it->second->getID(), it->second->getPeerID() );
    112113      delete it->second;
    113114    }
     
    117118    NetworkCallbackManager::callCallbacks();
    118119    return true;
     120  }
     121 
     122  bool GamestateManager::sendAck(unsigned int gamestateID, uint32_t peerID)
     123  {
     124    packet::Acknowledgement *ack = new packet::Acknowledgement(gamestateID, peerID);
     125    if( !this->sendPacket(ack))
     126    {
     127      COUT(3) << "could not ack gamestate: " << gamestateID << std::endl;
     128      return false;
     129    }
     130    else
     131    {
     132      COUT(5) << "acked a gamestate: " << gamestateID << std::endl;
     133      return true;
     134    }
    119135  }
    120136
     
    173189      peerGamestates.push_back(0);  // insert an empty gamestate* to change
    174190      finishGamestate( peerID, peerGamestates.back(), baseGamestate, currentGamestate_ );
     191      if( peerGamestates.back()==0 )
     192        // nothing to send to remove pointer from vector
     193        peerGamestates.pop_back();
    175194      //FunctorMember<GamestateManager>* functor =
    176195//       ExecutorMember<GamestateManager>* executor = createExecutor( createFunctor(&GamestateManager::finishGamestate, this) );
     
    236255
    237256
    238   bool GamestateManager::ackGamestate(unsigned int gamestateID, unsigned int peerID) {
     257  bool GamestateManager::ackGamestate(unsigned int gamestateID, unsigned int peerID)
     258  {
    239259//     ClientInformation *temp = ClientInformation::findClient(peerID);
    240260//     assert(temp);
     
    255275    }
    256276
    257     assert(curid==GAMESTATEID_INITIAL || curid<gamestateID);
     277    assert(curid==GAMESTATEID_INITIAL || curid<=gamestateID);
    258278    COUT(5) << "acking gamestate " << gamestateID << " for peerID: " << peerID << " curid: " << curid << std::endl;
    259279    std::map<uint32_t, packet::Gamestate*>::iterator it2;
Note: See TracChangeset for help on using the changeset viewer.