]> git.mxchange.org Git - flightgear.git/blobdiff - src/Instrumentation/dme.cxx
Minor main loop/init clean-up
[flightgear.git] / src / Instrumentation / dme.cxx
index d8d14a5a22078598760ce44a68bbb8bd3bdd0b96..ae1ce11e97af4d23b4371daabfb916453a5b59cd 100644 (file)
@@ -88,6 +88,14 @@ DME::init ()
     if( NULL == _audioIdent ) 
         _audioIdent = new DMEAudioIdent( temp.str() );
     _audioIdent->init();
+
+    reinit();
+}
+
+void
+DME::reinit ()
+{
+    _time_before_search_sec = 0;
 }
 
 void
@@ -119,8 +127,17 @@ DME::update (double delta_time_sec)
     if (_time_before_search_sec < 0) {
         _time_before_search_sec = 1.0;
 
-        _navrecord = globals->get_dmelist()->findByFreq( frequency_mhz,
-            globals->get_aircraft_position());
+        if( fgGetBool( "/sim/realism/dme-fallback-to-loc", true ) ) {
+            if( NULL == (_navrecord = globals->get_loclist()->findByFreq( frequency_mhz,
+                globals->get_aircraft_position())) ) {
+
+                _navrecord = globals->get_dmelist()->findByFreq( frequency_mhz,
+                    globals->get_aircraft_position());
+            }
+        } else {
+            _navrecord = globals->get_dmelist()->findByFreq( frequency_mhz,
+                globals->get_aircraft_position());
+        }
     }
 
     // If it's off, don't bother.