From 5c0fa275d7ad1e6dfc5ad7b4afe734521734dcdf Mon Sep 17 00:00:00 2001 From: curt Date: Mon, 10 Dec 2001 16:29:20 +0000 Subject: [PATCH] Tweaks to how we load aircraft defaults and definition file to make things more intuitive. We switch to an include in the preferences.xml to include the default model, and then if the user specifies --aircraft=, that is expanded immediately so portions can be overwritten by subsequent command line options. --- src/Main/fg_init.cxx | 14 -------------- src/Main/options.cxx | 15 ++++++++++++++- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index dd4d403e5..9917c989c 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -269,20 +269,6 @@ 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; } diff --git a/src/Main/options.cxx b/src/Main/options.cxx index 1546462c2..d640ffe2e 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -903,7 +903,20 @@ parse_option (const string& arg) exit(2); } } else if ( arg.find( "--aircraft=" ) == 0 ) { - fgSetString("/sim/aircraft", arg.substr(11)); + // read in the top level aircraft definition file + SGPath apath( globals->get_fg_root() ); + apath.append( "Aircraft" ); + apath.append( arg.substr(11) ); + apath.concat( "-set.xml" ); + try { + SGPropertyNode *sim = fgGetNode("/sim"); + readProperties( apath.str(), sim ); + } catch (const sg_exception &e) { + string message = "Error loading aircraft file: "; + message += e.getFormattedMessage(); + SG_LOG(SG_INPUT, SG_ALERT, message); + exit(2); + } } else { SG_LOG( SG_GENERAL, SG_ALERT, "Unknown option '" << arg << "'" ); return FG_OPTIONS_ERROR;