From e9f4106bc16b4dc55cdff4fae5f22ad31d30651a Mon Sep 17 00:00:00 2001 From: James Turner Date: Thu, 28 Oct 2010 13:54:45 +0100 Subject: [PATCH] Remove confusing default (missing) path from 2D panel code. --- src/Main/fg_commands.cxx | 8 +++++--- src/Main/fg_init.cxx | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/Main/fg_commands.cxx b/src/Main/fg_commands.cxx index 74551bc91..4fa1a7dc0 100644 --- a/src/Main/fg_commands.cxx +++ b/src/Main/fg_commands.cxx @@ -392,9 +392,11 @@ static bool do_panel_load (const SGPropertyNode * arg) { string panel_path = - arg->getStringValue("path", - fgGetString("/sim/panel/path", - "Panels/Default/default.xml")); + arg->getStringValue("path", fgGetString("/sim/panel/path")); + if (panel_path.empty()) { + return false; + } + FGPanel * new_panel = fgReadPanel(panel_path); if (new_panel == 0) { SG_LOG(SG_INPUT, SG_ALERT, diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index f154ab658..b3af6a617 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -1414,20 +1414,20 @@ bool fgInitSubsystems() { // Add a new 2D panel. //////////////////////////////////////////////////////////////////// - string panel_path = fgGetString("/sim/panel/path", - "Panels/Default/default.xml"); - - globals->set_current_panel( fgReadPanel(panel_path) ); - if (globals->get_current_panel() == 0) { + string panel_path(fgGetString("/sim/panel/path")); + if (!panel_path.empty()) { + FGPanel* p = fgReadPanel(panel_path); + if (p) { + globals->set_current_panel(p); + p->init(); + p->bind(); + SG_LOG( SG_INPUT, SG_INFO, "Loaded new panel from " << panel_path ); + } else { SG_LOG( SG_INPUT, SG_ALERT, "Error reading new panel from " << panel_path ); - } else { - SG_LOG( SG_INPUT, SG_INFO, "Loaded new panel from " << panel_path ); - globals->get_current_panel()->init(); - globals->get_current_panel()->bind(); + } } - //////////////////////////////////////////////////////////////////// // Initialize the controls subsystem. //////////////////////////////////////////////////////////////////// -- 2.39.5