FlightGear version check

From FlightGear wiki
Revision as of 18:22, 17 November 2015 by Hooray (talk | contribs) (→‎Fgdata)
Jump to navigation Jump to search
This article is a stub. You can help the wiki by expanding it.


Note  When installing/using aircraft the FlightGear version and the aircraft version must match. Otherwise strange bugs should be expected and the version-mismatch combination will not be supported by the FlightGear community.
PUI dialog showing a version conflict between the FlightGear version and aircraft version
The same dialog as processed by pui2canvas

If in doubt, people should check the about dialog or /sim/version/ in the property tree using the property browser.

For aircraft developers

This article describes content/features that may not yet be available in the latest stable version of FlightGear (2020.3).
You may need to install some extra components, use the latest development (Git) version or even rebuild FlightGear from source, possibly from a custom topic branch using special build settings: .

This feature is scheduled for FlightGear (unknown). 10}% completed

If you'd like to learn more about getting your own ideas into FlightGear, check out Implementing new features for FlightGear.

<minimum-flightgear-version>4.0.0</minimum-flightgear-version>

Minimum FlightGear version required for this aircraft, note that this is a "soft" requirement — i.e., it will not terminate FlightGear or trigger an error, but will only show a warning in the console using a Nasal script that checks if the property is set. This is mainly intended to make compatibility issues more obvious, such as end-users downloading new aircraft and wanting to use them in conjunction with an old version of FlightGear, which is causing quite a bit of workload on the support forum. We are hoping to also display this info in the about dialog.

The Saab JA-37 Viggen is a good example of using Nasal and properties to provide backwards-compatibility. See ja37.nas for the relevant code.

Fgdata

Note  This is currently just proof-of-concept code which will need to be refined/reviewed and committed to FGData.
Property browser showing the /sim/version properties.

translations

A critical error dialog should preferably support localized error messages. However, PUI XML dialogs cannot directly support translations, so we need to emulate that using Property overlays.

Cquote1.png names/strings would need to be resolved by using translations as an overlay
— Hooray (Feb 23rd, 2014). Re: Multi screen configuration not working.
(powered by Instant-Cquotes)
Cquote2.png
Cquote1.png There's no C++ code handling that stuff directly - it's all PropertyList-encoded XML files in $FG_ROOT/Translations - menubar.xml/options.xml etc will typically not contain hard-coded "strings" but rather references that are resolved by loading the proper language.xml as an overlay, i.e. key=value during startup - see locale.xml and

$FG_SRC//Main:

  • locale.cxx:191: // load resource for system messages (translations for fgfs internal messages)
  • options.cxx:316: // $FG_ROOT/data/Translations/string-default.xml
  • options.cxx:2310: // There may be more than one translation line.
    — Hooray (Feb 21st, 2014). Re: Where's translation?.
    (powered by Instant-Cquotes)
Cquote2.png

dialog


Nasal module

This script ensures that the check will be executed for each loaded aircraft, without having to touch any aircraft-set.xml files, and it will also work with reset & re-init.

# $FG_ROOT/Nasal/version.nas
# anonymous function that will be called directly
(func() {
    # get current aircraft
    var ac = getprop("/sim/aircraft");
    var url = 'http://wiki.flightgear.org/FlightGear_Version_Check';
    var fgversion = getprop("/sim/version/flightgear");

    logprint(3, "FlightGear v" ~ fgversion);

    var acversion = getprop("/sim/minimum-flightgear-version");

    if (acversion == nil) {
        logprint(4, ac ~ "-set.xml file missing version info, see " ~ url);
        return; # version not specified 
    }

    logprint(3, "Aircraft requires FlightGear v" ~ acversion);

    # parse the version number into major/minor and patch level
    # http://wiki.flightgear.org/Nasal_library#split.28.29
    var (major, minor, patch) = split(".", acversion);
})();

Related content

Forum topics