From: James Turner Date: Mon, 31 Oct 2011 13:08:58 +0000 (+0000) Subject: Restore options *processing* order (which is now distinct from *parsing* order),... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=e3037b638f146ec50c16b3fed2d61940c15c7856;p=flightgear.git Restore options *processing* order (which is now distinct from *parsing* order), to resolve issues when distinct but internally overlapping options are specified, e.g. for initial position or time. --- diff --git a/src/Main/options.cxx b/src/Main/options.cxx index 62677a5fd..b6f4598eb 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -1951,14 +1951,17 @@ void Options::processOptions() exit(0); } - BOOST_FOREACH(const OptionValue& v, p->values) { - int result = p->processOption(v.desc, v.value); + // proces options in LIFO order, so earlier (first in) options are processed + // after, and hence override, later specified options. + OptionValueVec::const_reverse_iterator it = p->values.rbegin(); + for (; it != p->values.rend(); ++it) { + int result = p->processOption(it->desc, it->value); if (result == FG_OPTIONS_ERROR) { showUsage(); exit(-1); } } - + BOOST_FOREACH(const SGPath& file, p->propertyFiles) { if (!file.exists()) { SG_LOG(SG_GENERAL, SG_ALERT, "config file not found:" << file.str());