Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 29, 2008, 2:16:15 PM (16 years ago)
Author:
scheusso
Message:

network tick limit works now

File:
1 edited

Legend:

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

    r2009 r2048  
    6262namespace network
    6363{
    64   const int MAX_FAILURES = 20;
    65   const int NETWORK_FREQUENCY = 30;
     64  const unsigned int MAX_FAILURES = 20;
     65  const unsigned int NETWORK_FREQUENCY = 25;
     66  const float NETWORK_PERIOD = (float)1/NETWORK_FREQUENCY;
    6667
    6768  /**
     
    153154    //this steers our network frequency
    154155    timeSinceLastUpdate_+=time;
    155     if(timeSinceLastUpdate_>=(1./NETWORK_FREQUENCY)){
    156       timeSinceLastUpdate_=(float)((int)(timeSinceLastUpdate_*NETWORK_FREQUENCY))/timeSinceLastUpdate_;
     156    if(timeSinceLastUpdate_>=NETWORK_PERIOD){
     157      timeSinceLastUpdate_ -= static_cast<unsigned int>( timeSinceLastUpdate_ / NETWORK_PERIOD ) * NETWORK_PERIOD;
    157158      gamestates_->processGamestates();
    158159      updateGamestate();
Note: See TracChangeset for help on using the changeset viewer.