Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8403


Ignore:
Timestamp:
May 5, 2011, 4:02:40 PM (14 years ago)
Author:
scheusso
Message:

fixing possible bug with packet ordering

Location:
code/trunk/src/libraries/network
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/libraries/network/FunctionCallManager.cc

    r7801 r8403  
    3131#include "core/GameMode.h"
    3232#include "GamestateHandler.h"
     33#include "Host.h"
     34#include "util/OrxAssert.h"
    3335
    3436namespace orxonox {
     
    175177  while( it!=FunctionCallManager::sIncomingFunctionCallBuffer_.end() )
    176178  {
    177     if( it->first.execute() )
     179    OrxAssert( Host::getActiveInstance(), "No Host class existing" );
     180    if( it->second.first <= Host::getActiveInstance()->getLastReceivedGamestateID(it->second.second) && it->first.execute() )
    178181      FunctionCallManager::sIncomingFunctionCallBuffer_.erase(it);
    179182    else
  • code/trunk/src/libraries/network/Host.cc

    r8327 r8403  
    161161    return false;
    162162  }
     163 
     164  Host* Host::getActiveInstance()
     165  {
     166    std::vector<Host*>::iterator it = Host::instances_s.begin();
     167    while( it != Host::instances_s.end() )
     168    {
     169      if( (*it)->isActive() )
     170        return *it;
     171    }
     172    return 0;
     173  }
     174
    163175
    164176}//namespace orxonox
  • code/trunk/src/libraries/network/Host.h

    r7801 r8403  
    7171
    7272  public:
    73 //     static Host* getInstance(){ return instance_; }
     73    static Host* getActiveInstance();
    7474    static bool running(){ return instances_s.size(); }
    7575    static void addPacket(ENetPacket* packet, int clientID = NETWORK_PEER_ID_SERVER, uint8_t channelID = 0);
Note: See TracChangeset for help on using the changeset viewer.