From: James Turner Date: Mon, 10 Mar 2014 13:26:58 +0000 (+0000) Subject: Fix fg-aircraft, fg-scenery props after reset. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=94890095707d3c11ff356efeb293ba0d93705c80;p=flightgear.git Fix fg-aircraft, fg-scenery props after reset. - restore fg-aircraft properties, and PRESERVE fg-scenery ones, across reset. --- diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index d0022f6dd..6c5ca203c 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -480,7 +480,21 @@ int fgInitConfig ( int argc, char **argv, bool reinit ) int fgInitAircraft(bool reinit) { // Scan user config files and command line for a specified aircraft. - if (!reinit) { + if (reinit) { + SGPropertyNode* sim = fgGetNode("/sim", true); + sim->removeChildren("fg-aircraft"); + // after reset, add aircraft dirs to props, neede for Nasal IO rules + string_list::const_iterator it; + int index = 0; + for (it = globals->get_aircraft_paths().begin(); + it != globals->get_aircraft_paths().end(); ++it, ++index) + { + SGPropertyNode* n = sim->getChild("fg-aircraft", index, true); + n->setStringValue(*it); + n->setAttribute(SGPropertyNode::WRITE, false); + + } + } else { flightgear::Options::sharedInstance()->initAircraft(); } diff --git a/src/Main/globals.cxx b/src/Main/globals.cxx index 74e0656d8..8ed71cbd5 100644 --- a/src/Main/globals.cxx +++ b/src/Main/globals.cxx @@ -390,6 +390,9 @@ void FGGlobals::append_fg_scenery (const std::string &paths) SGPropertyNode* n = sim->getChild("fg-scenery", propIndex++, true); n->setStringValue(abspath.str()); n->setAttribute(SGPropertyNode::WRITE, false); + + // temporary fix so these values survive reset + n->setAttribute(SGPropertyNode::PRESERVE, true); } // of path list iteration }