From cdd7998c90ebedb4b86e42f09a705bdbde0754b7 Mon Sep 17 00:00:00 2001 From: ehofman Date: Tue, 1 Apr 2003 13:42:10 +0000 Subject: [PATCH] David Luff: The one to fg_init.cxx initialises the AI subsystem regardless of whether it's enabled or not so that later enabling by the user doesn't crash it, and the one to main.cxx avoids running the ATC manager and ATC display system unless enabled. --- src/Main/fg_init.cxx | 8 +++----- src/Main/main.cxx | 6 ++++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index 04f8ca1cb..e2e23766e 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -1523,11 +1523,9 @@ bool fgInitSubsystems() { // Initialise the AI Manager //////////////////////////////////////////////////////////////////// - if (fgGetBool("/sim/ai-traffic/enabled")) { - SG_LOG(SG_GENERAL, SG_INFO, " AI Manager"); - globals->set_AI_mgr(new FGAIMgr); - globals->get_AI_mgr()->init(); - } + SG_LOG(SG_GENERAL, SG_INFO, " AI Manager"); + globals->set_AI_mgr(new FGAIMgr); + globals->get_AI_mgr()->init(); #ifdef ENABLE_AUDIO_SUPPORT diff --git a/src/Main/main.cxx b/src/Main/main.cxx index ab2ded38f..d583fbd5c 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -892,7 +892,8 @@ void fgRenderFrame() { // Use the hud_and_panel ssgSimpleState for rendering the ATC output // This only works properly if called before the panel call - globals->get_ATC_display()->update(delta_time_sec); + if((fgGetBool("/sim/ATC/enabled")) || (fgGetBool("/sim/ai-traffic/enabled"))) + globals->get_ATC_display()->update(delta_time_sec); // update the panel subsystem if ( globals->get_current_panel() != NULL ) { @@ -1184,7 +1185,8 @@ static void fgMainLoop( void ) { #endif // Run ATC subsystem - globals->get_ATC_mgr()->update(delta_time_sec); + if (fgGetBool("/sim/ATC/enabled")) + globals->get_ATC_mgr()->update(delta_time_sec); // Run the AI subsystem if (fgGetBool("/sim/ai-traffic/enabled"))