From 98aa76ad33be7bd3a915ea03f2ba25431872a92e Mon Sep 17 00:00:00 2001 From: mfranz Date: Sun, 28 Jan 2007 11:40:56 +0000 Subject: [PATCH] Maik JUSTUS: fix bug that caused aircraft zombies on an MP player's last position after he reset his fgfs --- src/AIModel/AIMultiplayer.cxx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) 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; }