1
0
Fork 0

Code clean ups.

This commit is contained in:
curt 2002-09-26 17:25:19 +00:00
parent cd9c38e0b4
commit 3fdcbbd6ce
2 changed files with 6 additions and 20 deletions

View 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;

View 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; }