From: curt Date: Thu, 26 Sep 2002 17:25:19 +0000 (+0000) Subject: Code clean ups. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=3fdcbbd6ceba19ed8361f012f8bc84244c74bb8d;p=flightgear.git Code clean ups. --- diff --git a/src/Cockpit/kr_87.cxx b/src/Cockpit/kr_87.cxx index 2c65a3823..aef0736de 100644 --- a/src/Cockpit/kr_87.cxx +++ b/src/Cockpit/kr_87.cxx @@ -73,6 +73,7 @@ FGKR_87::FGKR_87() : lon_node(fgGetNode("/position/longitude-deg", true)), lat_node(fgGetNode("/position/latitude-deg", true)), alt_node(fgGetNode("/position/altitude-ft", true)), + bus_power(fgGetNode("/systems/electrical/outputs/adf", true)), need_update(true), valid(false), inrange(false), @@ -103,25 +104,11 @@ FGKR_87::FGKR_87() : elapsed_timer(0.0), tmp_timer(0.0) { - SGPath path( globals->get_fg_root() ); - SGPath term = path; - term.append( "Navaids/range.term" ); - SGPath low = path; - low.append( "Navaids/range.low" ); - SGPath high = path; - high.append( "Navaids/range.high" ); - - term_tbl = new SGInterpTable( term.str() ); - low_tbl = new SGInterpTable( low.str() ); - high_tbl = new SGInterpTable( high.str() ); } // Destructor FGKR_87::~FGKR_87() { - delete term_tbl; - delete low_tbl; - delete high_tbl; } @@ -260,7 +247,7 @@ void FGKR_87::update( double dt ) { // Radio //////////////////////////////////////////////////////////////////////// - if ( power_btn ) { + if ( has_power() ) { // buttons if ( adf_btn == 0 ) { ant_mode = 1; diff --git a/src/Cockpit/kr_87.hxx b/src/Cockpit/kr_87.hxx index 5b6069e99..c0b482e5a 100644 --- a/src/Cockpit/kr_87.hxx +++ b/src/Cockpit/kr_87.hxx @@ -30,7 +30,6 @@ #include -#include #include #include @@ -41,13 +40,10 @@ class FGKR_87 : public FGSubsystem { FGMorse morse; - SGInterpTable *term_tbl; - SGInterpTable *low_tbl; - SGInterpTable *high_tbl; - SGPropertyNode *lon_node; SGPropertyNode *lat_node; SGPropertyNode *alt_node; + SGPropertyNode *bus_power; bool need_update; @@ -128,6 +124,9 @@ public: inline double get_stn_lat() const { return stn_lat; } inline double get_dist() const { return dist; } inline double get_heading() const { return heading; } + inline bool has_power() const { + return power_btn && (bus_power->getDoubleValue() > 1.0); + } // modes inline int get_ant_mode() const { return ant_mode; }