don't blindly overwrite user settings -- only initialize if necessary
This commit is contained in:
parent
cd4b05909d
commit
8c1b1f50a5
1 changed files with 10 additions and 8 deletions
|
@ -63,8 +63,7 @@ FGMarkerBeacon::FGMarkerBeacon(SGPropertyNode *node) :
|
||||||
low_tbl = new SGInterpTable( low.str() );
|
low_tbl = new SGInterpTable( low.str() );
|
||||||
high_tbl = new SGInterpTable( high.str() );
|
high_tbl = new SGInterpTable( high.str() );
|
||||||
|
|
||||||
int i;
|
for ( int i = 0; i < node->nChildren(); ++i ) {
|
||||||
for ( i = 0; i < node->nChildren(); ++i ) {
|
|
||||||
SGPropertyNode *child = node->getChild(i);
|
SGPropertyNode *child = node->getChild(i);
|
||||||
string cname = child->getName();
|
string cname = child->getName();
|
||||||
string cval = child->getStringValue();
|
string cval = child->getStringValue();
|
||||||
|
@ -110,9 +109,12 @@ FGMarkerBeacon::init ()
|
||||||
audio_vol = node->getChild("volume", 0, true);
|
audio_vol = node->getChild("volume", 0, true);
|
||||||
serviceable = node->getChild("serviceable", 0, true);
|
serviceable = node->getChild("serviceable", 0, true);
|
||||||
|
|
||||||
power_btn->setBoolValue( true );
|
if (power_btn->getType() == SGPropertyNode::NONE)
|
||||||
audio_btn->setBoolValue( true );
|
power_btn->setBoolValue( true );
|
||||||
serviceable->setBoolValue( true );
|
if (audio_btn->getType() == SGPropertyNode::NONE)
|
||||||
|
audio_btn->setBoolValue( true );
|
||||||
|
if (serviceable->getType() == SGPropertyNode::NONE)
|
||||||
|
serviceable->setBoolValue( true );
|
||||||
|
|
||||||
morse.init();
|
morse.init();
|
||||||
beacon.init();
|
beacon.init();
|
||||||
|
@ -165,7 +167,7 @@ FGMarkerBeacon::update(double dt)
|
||||||
|
|
||||||
_time_before_search_sec -= dt;
|
_time_before_search_sec -= dt;
|
||||||
if ( _time_before_search_sec < 0 ) {
|
if ( _time_before_search_sec < 0 ) {
|
||||||
search();
|
search();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( has_power() && serviceable->getBoolValue()
|
if ( has_power() && serviceable->getBoolValue()
|
||||||
|
@ -250,7 +252,7 @@ static bool check_beacon_range( const SGGeod& pos,
|
||||||
|
|
||||||
class BeaconFilter : public FGPositioned::Filter
|
class BeaconFilter : public FGPositioned::Filter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual FGPositioned::Type minType() const {
|
virtual FGPositioned::Type minType() const {
|
||||||
return FGPositioned::OM;
|
return FGPositioned::OM;
|
||||||
}
|
}
|
||||||
|
@ -280,7 +282,7 @@ void FGMarkerBeacon::search()
|
||||||
// get closest marker beacon - within a 1nm cutoff
|
// get closest marker beacon - within a 1nm cutoff
|
||||||
BeaconFilter filter;
|
BeaconFilter filter;
|
||||||
FGPositionedRef b = FGPositioned::findClosest(pos, 1.0, &filter);
|
FGPositionedRef b = FGPositioned::findClosest(pos, 1.0, &filter);
|
||||||
|
|
||||||
fgMkrBeacType beacon_type = NOBEACON;
|
fgMkrBeacType beacon_type = NOBEACON;
|
||||||
bool inrange = false;
|
bool inrange = false;
|
||||||
if ( b != NULL ) {
|
if ( b != NULL ) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue