]> git.mxchange.org Git - flightgear.git/commitdiff
Small tweaks to initialization sequence and logic so we can default to
authorcurt <curt>
Sun, 9 Dec 2001 05:19:50 +0000 (05:19 +0000)
committercurt <curt>
Sun, 9 Dec 2001 05:19:50 +0000 (05:19 +0000)
a top level aircraft def file (c172-set.xml)

preferences.xml or --aircraft= or any other property setting mechanism can
be used to set the property "/sim/aircraft".  After all options and config
files are parsed, the contents of /sim/aircraft is expanded into a *-set.xml
file and loaded.

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

index 9917c989ce736a8f259cdb6abfea5d41697e1371..dd4d403e5fdc424084cf0882e2386d7b4427d798 100644 (file)
@@ -269,6 +269,20 @@ bool fgInitConfig ( int argc, char **argv ) {
     // These will override anything specified in a config file
     fgParseOptions(argc, argv);
 
+    // read in the top level aircraft definition file
+    SGPath apath( globals->get_fg_root() );
+    apath.append( "Aircraft" );
+    apath.append( fgGetString("/sim/aircraft") );
+    apath.concat( "-set.xml" );
+    try {
+       readProperties(apath.str(), globals->get_props());
+    } catch (const sg_exception &e) {
+       string message = "Error loading aircraft file: ";
+       message += e.getFormattedMessage();
+       SG_LOG(SG_INPUT, SG_ALERT, message);
+       exit(2);
+    }
+
     return true;
 }
 
index 64e08624a6e56bf37324dba328cc45252139133e..1546462c26a5031163f4b4bd6132b11d0ac1a589 100644 (file)
@@ -903,18 +903,7 @@ parse_option (const string& arg)
          exit(2);
        }
     } else if ( arg.find( "--aircraft=" ) == 0 ) {
-        SGPath apath(globals->get_fg_root());
-       apath.append("Aircraft");
-       apath.append(arg.substr(11));
-       apath.concat("-set.xml");
-       try {
-            readProperties(apath.str(), globals->get_props());
-       } catch (const sg_exception &e) {
-            string message = "Error loading aircraft file: ";
-            message += e.getFormattedMessage();
-            SG_LOG(SG_INPUT, SG_ALERT, message);
-            exit(2);
-       }
+       fgSetString("/sim/aircraft", arg.substr(11));
     } else {
        SG_LOG( SG_GENERAL, SG_ALERT, "Unknown option '" << arg << "'" );
        return FG_OPTIONS_ERROR;