#include <Main/fg_props.hxx>
#include <Main/util.hxx>
+#include <simgear/magvar/magvar.hxx>
HeadingIndicator::HeadingIndicator ( SGPropertyNode *node )
:
branch = "/instrumentation/" + _name;
SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
- _offset_node = node->getChild("offset-deg", 0, true);
+ if( NULL == (_offset_node = node->getChild("offset-deg", 0, false)) ) {
+ _offset_node = node->getChild("offset-deg", 0, true);
+ _offset_node->setDoubleValue( -globals->get_mag()->get_magvar() * SGD_RADIANS_TO_DEGREES );
+ }
_heading_in_node = fgGetNode("/orientation/heading-deg", true);
_suction_node = fgGetNode(_suction.c_str(), true);
_heading_out_node = node->getChild("indicated-heading-deg", 0, true);
#include <Main/fg_props.hxx>
#include <Main/util.hxx>
+#include <simgear/magvar/magvar.hxx>
+
using std::string;
HeadingIndicatorFG::HeadingIndicatorFG ( SGPropertyNode *node )
_heading_in_node = fgGetNode("/orientation/heading-deg", true);
SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
- _offset_node = node->getChild("offset-deg", 0, true);
+ if( NULL == (_offset_node = node->getChild("offset-deg", 0, false)) ) {
+ _offset_node = node->getChild("offset-deg", 0, true);
+ _offset_node->setDoubleValue( -globals->get_mag()->get_magvar() * SGD_RADIANS_TO_DEGREES );
+ }
_serviceable_node = node->getChild("serviceable", 0, true);
_error_node = node->getChild("heading-bug-error-deg", 0, true);
_nav1_error_node = node->getChild("nav1-course-error-deg", 0, true);
fgGetDouble("/position/altitude-ft")
* SG_FEET_TO_METER,
globals->get_time_params()->getJD() );
- double var = globals->get_mag()->get_magvar() * SGD_RADIANS_TO_DEGREES;
- fgSetDouble("/instrumentation/heading-indicator/offset-deg", -var);
- fgSetDouble("/instrumentation/heading-indicator-fg/offset-deg", -var);
fgSplashProgress("initializing subsystems");