]> git.mxchange.org Git - flightgear.git/commitdiff
FlightHistory: spatial limit on captures.
authorJames Turner <zakalawe@mac.com>
Tue, 11 Dec 2012 09:17:25 +0000 (09:17 +0000)
committerJames Turner <zakalawe@mac.com>
Tue, 11 Dec 2012 09:17:25 +0000 (09:17 +0000)
If you're not paused, but are stationary, don't record captures.

src/Aircraft/FlightHistory.cxx

index 82304fdd434ca768bfd55d01864a33b5fc52700e..0a30261f7a0b67a4c6ac9941a8eb16836c03aa98 100644 (file)
@@ -97,6 +97,15 @@ void FGFlightHistory::update(double dt)
         }
     } // of rest-on-takeoff enabled
     
+// spatial check - moved at least 1m since last capture
+    if (!m_buckets.empty()) {
+        SGVec3d lastCaptureCart(SGVec3d::fromGeod(m_buckets.back()->samples[m_validSampleCount - 1].position));
+        double d2 = distSqr(lastCaptureCart, globals->get_aircraft_position_cart());
+        if (d2 <= 1.0) {
+            return;
+        }
+    }
+    
     double elapsed = globals->get_sim_time_sec() - m_lastCaptureTime;
     if (elapsed > m_sampleInterval) {
         capture();