]> git.mxchange.org Git - flightgear.git/commitdiff
Modified initial property parsing order to be more intuitive. It now
authordavid <david>
Tue, 11 Dec 2001 19:27:37 +0000 (19:27 +0000)
committerdavid <david>
Tue, 11 Dec 2001 19:27:37 +0000 (19:27 +0000)
works like this:

1. Parse preferences.xml, which will usually specify a default
aircraft using the /sim/aircraft property.

2. If /sim/aircraft is specified and not empty, parse the properties
in $FG_ROOT/Aircraft/{/sim/aircraft}-set.xml to set up a default
aircraft.

3. During command-line parsing, whenever the --aircraft option appears
set /sim/aircraft appropriately and parse the properties in
$FG_ROOT/Aircraft/{/sim/aircraft}-set.xml.  Any --config, --prop, or
--aircraft options afterwards will take precedence.

src/Main/fg_init.cxx
src/Main/options.cxx

index 9917c989ce736a8f259cdb6abfea5d41697e1371..2f0aedac4bb47444e25a1c977f0190952835f5f7 100644 (file)
@@ -232,6 +232,26 @@ bool fgInitConfig ( int argc, char **argv ) {
     }
     SG_LOG(SG_INPUT, SG_INFO, "Finished Reading global preferences");
 
+    // Read the default aircraft config file.
+    string aircraft = fgGetString("/sim/aircraft", "");
+    if (aircraft.size() > 0) {
+      SGPath aircraft_path(globals->get_fg_root());
+      aircraft_path.append("Aircraft");
+      aircraft_path.append(aircraft);
+      aircraft_path.concat("-set.xml");
+      SG_LOG(SG_INPUT, SG_INFO, "Reading default aircraft: " << aircraft);
+      try {
+       readProperties(props_path.str(), globals->get_props());
+      } catch (const sg_exception &e) {
+       string message = "Error reading default aircraft: ";
+       message += e.getFormattedMessage();
+       SG_LOG(SG_INPUT, SG_ALERT, message);
+       exit(2);
+      }
+    } else {
+      SG_LOG(SG_INPUT, SG_ALERT, "No default aircraft specified");
+    }
+
     // Attempt to locate and parse the various config files in order
     // from least precidence to greatest precidence
 
index d640ffe2eb85b6fcadfa9e9dfaa241678a0596a8..44aae7246c97527cdd3848bd619c109c10886633 100644 (file)
@@ -909,8 +909,7 @@ parse_option (const string& arg)
         apath.append( arg.substr(11) );
         apath.concat( "-set.xml" );
         try {
-            SGPropertyNode *sim = fgGetNode("/sim");
-            readProperties( apath.str(), sim );
+            readProperties( apath.str(), globals->get_props() );
         } catch (const sg_exception &e) {
             string message = "Error loading aircraft file: ";
             message += e.getFormattedMessage();