]> git.mxchange.org Git - flightgear.git/commitdiff
Maik JUSTUS: fix bug that caused aircraft zombies on an MP player's last
authormfranz <mfranz>
Sun, 28 Jan 2007 11:40:56 +0000 (11:40 +0000)
committermfranz <mfranz>
Sun, 28 Jan 2007 11:40:56 +0000 (11:40 +0000)
             position after he reset his fgfs

src/AIModel/AIMultiplayer.cxx

index 70cf081ec6091d287556b7e70433d45352ccdaf7..717dc72afde736e4d5de6b665274f3e181a6ec78 100755 (executable)
@@ -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;
 }