X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FInstrumentation%2Fkr_87.cxx;h=6683f8f935b563f3d784eb6991051836cba7fa23;hb=c6045147544badd6daefdcab9d4de1ed6936533b;hp=4749ce856a47d768119958b61d4128e4b6b70016;hpb=667e64e1ebc86a0c53112b92b53475898f315c36;p=flightgear.git diff --git a/src/Instrumentation/kr_87.cxx b/src/Instrumentation/kr_87.cxx index 4749ce856..6683f8f93 100644 --- a/src/Instrumentation/kr_87.cxx +++ b/src/Instrumentation/kr_87.cxx @@ -29,6 +29,8 @@ #include #include +#include +#include #include #include @@ -492,10 +494,9 @@ void FGKR_87::update( double dt_sec ) { // Update current nav/adf radio stations based on current postition void FGKR_87::search() { - double acft_lon = lon_node->getDoubleValue() * SGD_DEGREES_TO_RADIANS; - double acft_lat = lat_node->getDoubleValue() * SGD_DEGREES_TO_RADIANS; - double acft_elev = alt_node->getDoubleValue() * SG_FEET_TO_METER; - + SGGeod pos = SGGeod::fromDegFt(lon_node->getDoubleValue(), + lat_node->getDoubleValue(), alt_node->getDoubleValue()); + // FIXME: the panel should handle this static string last_ident = ""; @@ -506,9 +507,8 @@ void FGKR_87::search() { // ADF. //////////////////////////////////////////////////////////////////////// - FGNavRecord *adf - = globals->get_navlist()->findByFreq( freq, acft_lon, acft_lat, - acft_elev ); + + FGNavRecord *adf = globals->get_navlist()->findByFreq( freq, pos); if ( adf != NULL ) { char sfreq[128]; snprintf( sfreq, 10, "%d", freq ); @@ -524,8 +524,8 @@ void FGKR_87::search() { stn_lat = adf->get_lat(); stn_elev = adf->get_elev_ft(); range = adf->get_range(); - effective_range = kludgeRange(stn_elev, acft_elev, range); - xyz = adf->get_cart(); + effective_range = kludgeRange(stn_elev, pos.getElevationM(), range); + xyz = adf->cart(); if ( globals->get_soundmgr()->exists( "adf-ident" ) ) { globals->get_soundmgr()->remove( "adf-ident" );