1
0
Fork 0

JSD: Make false courses work for more than one instance of navradio.

This commit is contained in:
jmt 2009-12-20 16:13:20 +00:00 committed by Tim Moore
parent d2c7179cd0
commit 45d0e14cad
2 changed files with 13 additions and 9 deletions

View file

@ -156,7 +156,6 @@ FGNavRadio::FGNavRadio(SGPropertyNode *node) :
_name(node->getStringValue("name", "nav")),
_num(node->getIntValue("number", 0)),
_time_before_search_sec(-1.0),
_falseCoursesEnabled(true),
_sgr(NULL)
{
SGPath path( globals->get_fg_root() );
@ -217,8 +216,13 @@ FGNavRadio::init ()
tofrom_serviceable_node = createServiceableProp(node, "to-from");
dme_serviceable_node = createServiceableProp(node, "dme");
globals->get_props()->tie("sim/realism/false-radio-courses-enabled",
SGRawValuePointer<bool>(&_falseCoursesEnabled));
falseCoursesEnabledNode =
fgGetNode("/sim/realism/false-radio-courses-enabled");
if (!falseCoursesEnabledNode) {
falseCoursesEnabledNode =
fgGetNode("/sim/realism/false-radio-courses-enabled", true);
falseCoursesEnabledNode->setBoolValue(true);
}
// frequencies
SGPropertyNode *subnode = node->getChild("frequencies", 0, true);
@ -532,7 +536,7 @@ void FGNavRadio::updateReceiver(double dt)
SG_NORMALIZE_RANGE(r, -180.0, 180.0);
if ( is_loc ) {
if (_falseCoursesEnabled) {
if (falseCoursesEnabledNode->getBoolValue()) {
// The factor of 30.0 gives a period of 120 which gives us 3 cycles and six
// zeros i.e. six courses: one front course, one back course, and four
// false courses. Three of the six are reverse sensing.
@ -604,7 +608,7 @@ void FGNavRadio::updateGlideSlope(double dt, const SGVec3d& aircraft, double sig
double angle = atan2(dot_v, dot_h) * SGD_RADIANS_TO_DEGREES;
double deflectionAngle = target_gs - angle;
if (_falseCoursesEnabled) {
if (falseCoursesEnabledNode->getBoolValue()) {
// Construct false glideslopes. The scale factor of 1.5
// in the sawtooth gives a period of 6 degrees.
// There will be zeros at 3, 6r, 9, 12r et cetera

View file

@ -120,6 +120,9 @@ class FGNavRadio : public SGSubsystem
SGPropertyNode_ptr gps_xtrack_error_nm_node;
SGPropertyNode_ptr _magvarNode;
// realism setting, are false courses and GS lobes enabled?
SGPropertyNode_ptr falseCoursesEnabledNode;
// internal (private) values
int play_count;
@ -161,9 +164,6 @@ class FGNavRadio : public SGSubsystem
double _gsNeedleDeflection;
double _gsNeedleDeflectionNorm;
// realism setting, are false courses and GS lobes enabled?
bool _falseCoursesEnabled;
SGSharedPtr<SGSampleGroup> _sgr;
bool updateWithPower(double aDt);