X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FInstrumentation%2Fmarker_beacon.cxx;h=2037211bbf8e69a24d742ec3e99a9b9e4430d430;hb=43880b201cea2b120fefd99696ae0b43227358dc;hp=e636704fb90ef686a7307f4bd9ec35ab074ce7dc;hpb=89010e6b0ac344970dfe3e802e4e51703fedc8ff;p=flightgear.git diff --git a/src/Instrumentation/marker_beacon.cxx b/src/Instrumentation/marker_beacon.cxx index e636704fb..2037211bb 100644 --- a/src/Instrumentation/marker_beacon.cxx +++ b/src/Instrumentation/marker_beacon.cxx @@ -63,8 +63,7 @@ FGMarkerBeacon::FGMarkerBeacon(SGPropertyNode *node) : low_tbl = new SGInterpTable( low.str() ); high_tbl = new SGInterpTable( high.str() ); - int i; - for ( i = 0; i < node->nChildren(); ++i ) { + for ( int i = 0; i < node->nChildren(); ++i ) { SGPropertyNode *child = node->getChild(i); string cname = child->getName(); string cval = child->getStringValue(); @@ -110,9 +109,12 @@ FGMarkerBeacon::init () audio_vol = node->getChild("volume", 0, true); serviceable = node->getChild("serviceable", 0, true); - power_btn->setBoolValue( true ); - audio_btn->setBoolValue( true ); - serviceable->setBoolValue( true ); + if (power_btn->getType() == SGPropertyNode::NONE) + power_btn->setBoolValue( true ); + if (audio_btn->getType() == SGPropertyNode::NONE) + audio_btn->setBoolValue( true ); + if (serviceable->getType() == SGPropertyNode::NONE) + serviceable->setBoolValue( true ); morse.init(); beacon.init(); @@ -165,7 +167,7 @@ FGMarkerBeacon::update(double dt) _time_before_search_sec -= dt; if ( _time_before_search_sec < 0 ) { - search(); + search(); } if ( has_power() && serviceable->getBoolValue() @@ -251,10 +253,14 @@ static bool check_beacon_range( const SGGeod& pos, class BeaconFilter : public FGPositioned::Filter { public: - virtual bool pass(FGPositioned* aPos) const - { - return (aPos->type() >= FGPositioned::OM) && (aPos->type() <= FGPositioned::IM); + virtual FGPositioned::Type minType() const { + return FGPositioned::OM; } + + virtual FGPositioned::Type maxType() const { + return FGPositioned::IM; + } + }; // Update current nav/adf radio stations based on current postition @@ -276,7 +282,7 @@ void FGMarkerBeacon::search() // get closest marker beacon - within a 1nm cutoff BeaconFilter filter; FGPositionedRef b = FGPositioned::findClosest(pos, 1.0, &filter); - + fgMkrBeacType beacon_type = NOBEACON; bool inrange = false; if ( b != NULL ) {