]> git.mxchange.org Git - flightgear.git/commitdiff
Tacan: avoid a 'long-range' wgs84_inverse
authorJames Turner <zakalawe@mac.com>
Tue, 4 Feb 2014 14:54:39 +0000 (14:54 +0000)
committerJames Turner <zakalawe@mac.com>
Tue, 4 Feb 2014 14:54:39 +0000 (14:54 +0000)
- Only check mobile distance at all, if the mobile is valid

src/Instrumentation/tacan.cxx

index 07c2d617b8651727620f545ec11da9cbf73a5749..8b3fff699791bad2b30e8d4b9d3d8ae10ab87e3e 100644 (file)
@@ -138,7 +138,7 @@ TACAN::update (double delta_time_sec)
         return;
     }
 
-  SGGeod pos(globals->get_aircraft_position());
+    SGGeod pos(globals->get_aircraft_position());
                                 // On timeout, scan again
     _time_before_search_sec -= delta_time_sec;
     if ((_time_before_search_sec < 0 || _new_frequency) && _frequency_mhz >= 0)
@@ -150,10 +150,10 @@ TACAN::update (double delta_time_sec)
     double mobile_az2 = 0;
     double mobile_bearing = 0;
     double mobile_distance = 0;
-
-    geo_inverse_wgs_84(pos, _mobilePos,
+    if (_mobile_valid) {
+        geo_inverse_wgs_84(pos, _mobilePos,
                        &mobile_bearing, &mobile_az2, &mobile_distance);
-
+    }
 
     //calculate the bearing and range of the station from the aircraft
     double az2 = 0;