Re-apply partial fix for #222, JSBsim crash-on-reset
This commit is contained in:
parent
8fe3d6c8e8
commit
4b494b1d08
2 changed files with 21 additions and 0 deletions
|
@ -144,6 +144,8 @@ FGJSBsim::FGJSBsim( double dt )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resetPropertyState();
|
||||||
|
|
||||||
fdmex = new FGFDMExec( (FGPropertyManager*)globals->get_props() );
|
fdmex = new FGFDMExec( (FGPropertyManager*)globals->get_props() );
|
||||||
|
|
||||||
// Register ground callback.
|
// Register ground callback.
|
||||||
|
@ -1411,3 +1413,21 @@ void FGJSBsim::update_external_forces(double t_off)
|
||||||
fgSetDouble("/fdm/jsbsim/systems/hook/tailhook-pos-deg", fi);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -284,6 +284,7 @@ private:
|
||||||
|
|
||||||
void update_external_forces(double t_off);
|
void update_external_forces(double t_off);
|
||||||
|
|
||||||
|
void resetPropertyState();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue