From 9022c6a58dea4f5414fff6432cd6e0556c80693f Mon Sep 17 00:00:00 2001 From: Torsten Dreyer Date: Sun, 9 Oct 2011 20:21:02 +0200 Subject: [PATCH] Reintroduce an old bugture: use localizer as dme Our nav.dat.gz seem to have many bugs regarding paired LOC/DME where the DME is missing. A feature has recently been introduced to always use a LOC frequency as a DME to avoid these issues. However many LOC station do not have a DME paired at their frequency and this behaviour might be as confusing as having no DME where one should be. Before we get new/bugfree navdata, a property can be set to select the desired behaviour: if /sim/realism/dme-fallback-to-loc is true or absent, LOC will be treated as DME (realism is off) if /sim/realism/dme-fallback-to-loc is false, LOC will be NOT be treated as DME (realism is on) --- src/Instrumentation/dme.cxx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Instrumentation/dme.cxx b/src/Instrumentation/dme.cxx index d8d14a5a2..bcea965d8 100644 --- a/src/Instrumentation/dme.cxx +++ b/src/Instrumentation/dme.cxx @@ -119,8 +119,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.