Hi,

I (and other user) have the problem, that sometimes a MP-aircraft after resetting by its pilot is displayed at the last position before the reset for a long while. In this cases, the time stamps of the packets sent by the MP-aircraft have a much older timestamp than the last one before the reset. Therefore they are all discarded, as long the time stamp is not large enough. The attached patch fixes this. But I am not sure, if the mMotionInfo.clear(); is all what is needed to do or if the members need to be deleted (but probably not, the discarded packages are now not deleted, too).

Please have o look on this and commit, if ok (without the debug cout).

Maik
Index: AIMultiplayer.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/AIModel/AIMultiplayer.cxx,v
retrieving revision 1.12.2.2
diff -u -p -r1.12.2.2 AIMultiplayer.cxx
--- AIMultiplayer.cxx   13 Jan 2007 16:19:04 -0000      1.12.2.2
+++ AIMultiplayer.cxx   21 Jan 2007 12:08:09 -0000
@@ -469,6 +470,14 @@ FGAIMultiplayer::addMotionInfo(const FGE
                                long stamp)
 {
   mLastTimestamp = stamp;
+  //Check if packet time is much junger than stored time
+  if (!mMotionInfo.empty() && motionInfo.time < 
(mMotionInfo.rbegin()->first-10)) {
+    //the packet seems to be very very old (much older then possible).
+    //this means, the MP-has reseted in between (and reseted) the time.
+    //delete the "old" motionInfos
+      mMotionInfo.clear();
+      cout<<"celared motionInfo of "<<mCallSign<<endl;
+  }
   // Drop packets arriving out of order
   if (!mMotionInfo.empty() && motionInfo.time < mMotionInfo.rbegin()->first)
     return;
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to