From: mfranz Date: Sun, 28 Jan 2007 11:40:56 +0000 (+0000) Subject: Maik JUSTUS: fix bug that caused aircraft zombies on an MP player's last X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=98aa76ad33be7bd3a915ea03f2ba25431872a92e;p=flightgear.git Maik JUSTUS: fix bug that caused aircraft zombies on an MP player's last position after he reset his fgfs --- diff --git a/src/AIModel/AIMultiplayer.cxx b/src/AIModel/AIMultiplayer.cxx index 70cf081ec..717dc72af 100755 --- a/src/AIModel/AIMultiplayer.cxx +++ b/src/AIModel/AIMultiplayer.cxx @@ -469,9 +469,18 @@ FGAIMultiplayer::addMotionInfo(const FGExternalMotionData& motionInfo, long stamp) { mLastTimestamp = stamp; - // Drop packets arriving out of order - if (!mMotionInfo.empty() && motionInfo.time < mMotionInfo.rbegin()->first) - return; + + if (!mMotionInfo.empty()) { + double diff = motionInfo.time - mMotionInfo.rbegin()->first; + + // packet is very old -- MP has probably reset (incl. his timebase) + if (diff < -10.0) + mMotionInfo.clear(); + + // drop packets arriving out of order + else if (diff < 0.0) + return; + } mMotionInfo[motionInfo.time] = motionInfo; }