From 0a6fe33bc34781dafe69702b81a03efcb2941747 Mon Sep 17 00:00:00 2001 From: James Turner Date: Fri, 10 Apr 2020 10:40:24 +0100 Subject: [PATCH] Add support for compatible-fg-version in -set.xml This is to evaluate if this is a good idea, not sure if we actually want to commit to this approach yet. --- src/Main/fg_init.cxx | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index efa39e94b..90f860a3c 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -389,7 +389,27 @@ private: } else { SG_LOG(SG_AIRCRAFT, SG_DEV_ALERT, "Aircraft does not specify a minimum FG version: please add one at /sim/minimum-fg-version"); } - + + auto compatNodes = globals->get_props()->getNode("/sim")->getChildren("compatible-fg-version"); + if (!compatNodes.empty()) { + bool showCompatWarning = true; + + // if we have at least one compatibility node, then it needs to match + for (const auto& cn : compatNodes) { + const auto v = cn->getStringValue(); + if (simgear::strutils::compareVersionToWildcard(FLIGHTGEAR_VERSION, v)) { + showCompatWarning = false; + break; + } + } + + if (showCompatWarning) { + flightgear::modalMessageBox("Aircraft not compatible with this version", + "The selected aircraft has not been checked for compatability with this version of FlightGear (" FLIGHTGEAR_VERSION "). " + "Some aircraft features might not work, or might be displayed incorrectly."); + } + } + return true; }