]> git.mxchange.org Git - flightgear.git/commitdiff
Fix NaNs in TACAN::update
authorCsaba Halasz <hcs@vostro.(none)>
Sun, 25 Oct 2009 14:11:20 +0000 (15:11 +0100)
committerTim Moore <timoore@redhat.com>
Tue, 22 Dec 2009 06:16:44 +0000 (07:16 +0100)
src/Instrumentation/tacan.cxx

index e00ac4f1a98ae8158f1d525e9fd2fc6041f80c4e..b17c8bb346386e06a01cc995085621808b966d48 100755 (executable)
@@ -127,6 +127,9 @@ TACAN::init ()
 void
 TACAN::update (double delta_time_sec)
 {
+    // don't do anything when paused
+    if (delta_time_sec == 0) return;
+
     if (!_serviceable_node->getBoolValue() || !_electrical_node->getBoolValue()) {
         _last_distance_nm = 0;
         _in_range_node->setBoolValue(false);
@@ -237,7 +240,7 @@ TACAN::update (double delta_time_sec)
         }
         _distance_node->setDoubleValue( tmp_dist );
         _speed_node->setDoubleValue(speed_kt);
-        _time_node->setDoubleValue(distance_nm/speed_kt*60.0);
+        _time_node->setDoubleValue(speed_kt > 0 ? (distance_nm/speed_kt*60.0) : 0);
         _bearing_node->setDoubleValue(bearing);
         _x_shift_node->setDoubleValue(x_shift);
         _y_shift_node->setDoubleValue(y_shift);