From c053de6b4c4c3a9b22648d3c7e798cfd087887c7 Mon Sep 17 00:00:00 2001 From: James Turner Date: Tue, 2 Nov 2010 23:19:09 +0000 Subject: [PATCH] If preset-commit occurs during init, skip most re-init logic. --- src/Main/fg_commands.cxx | 10 +++++++++- src/Main/fg_init.cxx | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Main/fg_commands.cxx b/src/Main/fg_commands.cxx index 46c6851b3..e3b6be0c0 100644 --- a/src/Main/fg_commands.cxx +++ b/src/Main/fg_commands.cxx @@ -1211,7 +1211,15 @@ do_play_audio_sample (const SGPropertyNode * arg) static bool do_presets_commit (const SGPropertyNode * arg) { - fgReInitSubsystems(); + if (fgGetBool("/sim/initialized", false)) { + fgReInitSubsystems(); + } else { + // Nasal can trigger this during initial init, which confuses + // the logic in ReInitSubsystems, since initial state has not been + // saved at that time. Short-circuit everything here. + fgInitPosition(); + } + return true; } diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index 024e6e2f7..65be585e4 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -1491,6 +1491,8 @@ bool fgInitSubsystems() { // End of subsystem initialization. //////////////////////////////////////////////////////////////////// + fgSetBool("/sim/initialized", true); + SG_LOG( SG_GENERAL, SG_INFO, endl); // Save the initial state for future