diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index 08f5a4d8d..fe3a9b801 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -717,7 +717,9 @@ void fgInitAircraftPaths(bool reinit) int fgInitAircraft(bool reinit) { if (!reinit) { - flightgear::Options::sharedInstance()->initAircraft(); + auto r = flightgear::Options::sharedInstance()->initAircraft(); + if (r == flightgear::FG_OPTIONS_SHOW_AIRCRAFT) + return r; } FindAndCacheAircraft f(globals->get_props()); diff --git a/src/Main/main.cxx b/src/Main/main.cxx index 955cc949c..5cec93dca 100755 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -647,7 +647,9 @@ int fgMainInit( int argc, char **argv ) configResult = fgInitAircraft(false); if (configResult == flightgear::FG_OPTIONS_ERROR) { return EXIT_FAILURE; - } else if (configResult == flightgear::FG_OPTIONS_EXIT) { + } else if ((configResult == flightgear::FG_OPTIONS_EXIT) || + (configResult == flightgear::FG_OPTIONS_SHOW_AIRCRAFT)) + { return EXIT_SUCCESS; } diff --git a/src/Main/options.cxx b/src/Main/options.cxx index 75c46a69c..255383f1d 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -2211,7 +2211,7 @@ void Options::initPaths() } -void Options::initAircraft() +OptionResult Options::initAircraft() { string aircraft; if (isOptionSet("aircraft")) { @@ -2246,7 +2246,8 @@ void Options::initAircraft() aircraft_paths.end()); fgShowAircraft(path_list); - exit(0); + // this is to indicate that we did show it + return FG_OPTIONS_SHOW_AIRCRAFT; } if (isOptionSet("aircraft-dir")) { @@ -2268,6 +2269,8 @@ void Options::initAircraft() // can't validate this until the -set.xml is parsed fgSetString("/sim/aircraft-state", stateName); } + + return FG_OPTIONS_OK; } void Options::processArgResult(int result) diff --git a/src/Main/options.hxx b/src/Main/options.hxx index 4cd3bd995..c4a564563 100644 --- a/src/Main/options.hxx +++ b/src/Main/options.hxx @@ -130,7 +130,7 @@ public: /** * init the aircraft options */ - void initAircraft(); + OptionResult initAircraft(); /** * should defualt configuration files be loaded and processed or not?