From 0294db919ffc44fd176e8be26b97a7c552cc7391 Mon Sep 17 00:00:00 2001 From: Julian Smith Date: Thu, 1 Apr 2021 20:37:49 +0100 Subject: [PATCH] src/Main/fg_init.cxx: workaround for JSBSim failure because of reliance on FGReplay. JSBSim fails on startup if some properties are not already created; some of these are created by FGReplay, and this is going wrong now that FGReplay is being run after the FDM. So have added a hack where we call FGReplay::init() as soone as FGReplay has been created. --- src/Main/fg_init.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index a3f3d663f..fe0ddc13e 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -1103,7 +1103,14 @@ void fgCreateSubsystems(bool duringReset) { //////////////////////////////////////////////////////////////////// // Initialize the replay subsystem //////////////////////////////////////////////////////////////////// - globals->add_new_subsystem(SGSubsystemMgr::POST_FDM); + // We also call FGReplay::unit() method here, to work around a + // problem where JSBSim appears to rely on FGReplay creating certain + // properties before it is initialised. This caused problems when + // FGReplay was changed to be POST_FDM. + //////////////////////////////////////////////////////////////////// + globals->add_new_subsystem(SGSubsystemMgr::POST_FDM) + ->init(); // Special case. + globals->add_subsystem("history", new FGFlightHistory); #ifdef ENABLE_AUDIO_SUPPORT