]> git.mxchange.org Git - flightgear.git/commitdiff
Code clean ups.
authorcurt <curt>
Thu, 26 Sep 2002 17:25:19 +0000 (17:25 +0000)
committercurt <curt>
Thu, 26 Sep 2002 17:25:19 +0000 (17:25 +0000)
src/Cockpit/kr_87.cxx
src/Cockpit/kr_87.hxx

index 2c65a3823e84f1fe8863e1150feea021dc4b533d..aef0736de7e3563e045eb902fb26e8f85e6e0ae2 100644 (file)
@@ -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;
index 5b6069e991a5a12d72c6168fd2570bb806b82946..c0b482e5ae6533320f8e3df7e92eec093b322099 100644 (file)
@@ -30,7 +30,6 @@
 
 #include <simgear/compiler.h>
 
-#include <simgear/math/interpolater.hxx>
 #include <simgear/timing/timestamp.hxx>
 
 #include <Navaids/navlist.hxx>
@@ -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; }