]> git.mxchange.org Git - flightgear.git/blobdiff - src/AIModel/AIMultiplayer.cxx
- Added ultra-light traffic is now a separate traffic class that can have its
[flightgear.git] / src / AIModel / AIMultiplayer.cxx
index 70cf081ec6091d287556b7e70433d45352ccdaf7..b7b0f689cb8dc2e89118f1cc1257c676697beb79 100755 (executable)
@@ -48,7 +48,7 @@ bool FGAIMultiplayer::init(bool search_in_AI_path) {
     isTanker = false; // do this until this property is
                       // passed over the net
 
-    string str1 = mCallSign;
+    string str1 = _getCallsign();
     string str2 = "MOBIL";
 
     string::size_type loc1= str1.find( str2, 0 );
@@ -73,7 +73,7 @@ SGRawValueMethods<FGAIMultiplayer, type>(*this, &FGAIMultiplayer::get##name)
 SGRawValueMethods<FGAIMultiplayer, type>(*this, \
       &FGAIMultiplayer::get##name, &FGAIMultiplayer::set##name)
 
-    props->tie("callsign", AIMPROProp(const char *, CallSign));
+    //props->tie("callsign", AIMPROProp(const char *, CallSign));
 
     props->tie("controls/allow-extrapolation",
                AIMPRWProp(bool, AllowExtrapolation));
@@ -88,7 +88,7 @@ SGRawValueMethods<FGAIMultiplayer, type>(*this, \
 void FGAIMultiplayer::unbind() {
     FGAIBase::unbind();
 
-    props->untie("callsign");
+    //props->untie("callsign");
     props->untie("controls/allow-extrapolation");
     props->untie("controls/lag-adjust-system-speed");
     props->untie("refuel/contact");
@@ -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;
 }