From 45de8ddf80d5834e3ec5fd947dcb7d24fa0a3698 Mon Sep 17 00:00:00 2001 From: Bertrand Coconnier Date: Sun, 12 Apr 2015 18:20:00 +0200 Subject: [PATCH] Modified the loop so that the simulation is suspended whenever the user set the property fdm/jsbsim/simulation/terminate to true. --- src/FDM/JSBSim/JSBSim.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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()); } -- 2.39.5