]> git.mxchange.org Git - flightgear.git/commitdiff
Remove confusing default (missing) path from 2D panel code.
authorJames Turner <zakalawe@mac.com>
Thu, 28 Oct 2010 12:54:45 +0000 (13:54 +0100)
committerJames Turner <zakalawe@mac.com>
Thu, 28 Oct 2010 12:54:45 +0000 (13:54 +0100)
src/Main/fg_commands.cxx
src/Main/fg_init.cxx

index 74551bc9170b683f7fc1aa87a7c82b97112e1d3e..4fa1a7dc05f1ed8dcc1ce76c621d5a21bf95adee 100644 (file)
@@ -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,
index f154ab658fd46665a809e9d4203085bae0970d8f..b3af6a617fdc47190710052dd7c651c3d9773404 100644 (file)
@@ -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.
     ////////////////////////////////////////////////////////////////////