From: Bertrand Coconnier Date: Sun, 12 Apr 2015 16:20:00 +0000 (+0200) Subject: Modified the loop so that the simulation is suspended whenever the user X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=45de8ddf80d5834e3ec5fd947dcb7d24fa0a3698;p=flightgear.git Modified the loop so that the simulation is suspended whenever the user set the property fdm/jsbsim/simulation/terminate to true. --- diff --git a/src/FDM/JSBSim/JSBSim.cxx b/src/FDM/JSBSim/JSBSim.cxx index c4e56d964..dbce5df72 100644 --- a/src/FDM/JSBSim/JSBSim.cxx +++ b/src/FDM/JSBSim/JSBSim.cxx @@ -523,7 +523,12 @@ void FGJSBsim::update( double dt ) trimmed->setBoolValue(false); for ( int i=0; i < multiloop; i++ ) { - fdmex->Run(); + if (!fdmex->Run()) { + // The property fdm/jsbsim/simulation/terminate has been set to true + // by the user. The sim is considered crashed. + crashed = true; + break; + } update_external_forces(fdmex->GetSimTime() + i * fdmex->GetDeltaT()); }