break;
}
}
+
+ resetPropertyState();
fdmex = new FGFDMExec( (FGPropertyManager*)globals->get_props() );
FGJSBsim::~FGJSBsim(void)
{
delete fdmex;
-
- SGPropertyNode_ptr jsbsimRoot = fgGetNode("/fdm/jsbsim");
- if (jsbsimRoot) {
- SGPropertyNode* fdm = jsbsimRoot->getParent();
- fdm->removeChild("jsbsim", 0, false);
- }
- // properties are deleted when the sharedPtr above goes away
}
/******************************************************************************/
fgSetDouble("/fdm/jsbsim/systems/hook/tailhook-pos-deg", fi);
}
+
+void FGJSBsim::resetPropertyState()
+{
+// this code works-around bug #222:
+// http://code.google.com/p/flightgear-bugs/issues/detail?id=222
+// for whatever reason, having an existing value for the WOW
+// property causes the NaNs. Should that be fixed, this code can die
+ SGPropertyNode* gear = fgGetNode("/fdm/jsbsim/gear", false);
+ if (!gear) {
+ return;
+ }
+
+ int index = 0;
+ SGPropertyNode* unitNode = NULL;
+ for (; (unitNode = gear->getChild("unit", index)) != NULL; ++index) {
+ unitNode->removeChild("WOW", 0, false);
+ }
+}
+