2,733
edits
(→For aircraft developers: Small fix for the {{Non-stable}} template.) |
Red Leader (talk | contribs) (Cleanup) |
||
Line 1: | Line 1: | ||
{{Stub}} | {{Stub}} | ||
{{-}} | |||
{{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.}} | |||
[[File:Version-mismatch-dialog.png|thumb|[[PUI]] dialog showing a version conflict between the FlightGear version and aircraft version]] | |||
[[File:Version-mismatch-dialog-via-pui2canvas.png|thumb|The same dialog as processed by [[Howto:Processing legacy PUI dialogs using Canvas|pui2canvas]]]] | |||
If in doubt, people should check the [[about dialog]] or <code>/sim/version/</code> in the [[property tree]] using the [[property browser]]. | |||
If in doubt, people should check the [[ | |||
== For aircraft developers == | == For aircraft developers == | ||
{{Non-stable}} | {{Non-stable}} | ||
<syntaxhighlight lang="xml"> | <syntaxhighlight lang="xml"> | ||
<minimum-flightgear-version>4.0.0</minimum-flightgear-version> | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Minimum FlightGear version required for this aircraft | 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 [[ | 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 [{{github url|NikolaiVChr/flightgear-saab-ja-37-viggen|Aircraft/JA37/Nasal/ja37.nas|l=1105/1203}} ja37.nas] for the relevant code. | |||
== Fgdata == | == Fgdata == | ||
{{Note|This is currently just proof-of-concept code which will need to be refined/reviewed and committed to FGData.}} | |||
[[File:Property-browser-showing-version-info.png|thumb|Property browser showing the <code>/sim/version</code> properties.]] | |||
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]]. | |||
<syntaxhighlight lang="nasal"> | <syntaxhighlight lang="nasal"> | ||
# $FG_ROOT/Nasal/version.nas | |||
# anonymous function that will be called directly | # anonymous function that will be called directly | ||
(func() { | (func() { | ||
# | # get current aircraft | ||
var ac = getprop("/sim/aircraft"); | |||
var ac = getprop("/sim/aircraft"); | var url = 'http://wiki.flightgear.org/FlightGear_Version_Check'; | ||
var url = | var fgversion = getprop("/sim/version/flightgear"); | ||
var fgversion = getprop("/sim/version/flightgear"); | |||
logprint(3,"FlightGear v | 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); | |||
logprint(3,"Aircraft requires FlightGear v | |||
# parse the version number into major/minor and patch level | # parse the version number into major/minor and patch level | ||
# http:// | # http://wiki.flightgear.org/Nasal_library#split.28.29 | ||
var (major, minor, patch) = split(".", acversion); | var (major, minor, patch) = split(".", acversion); | ||
} | })(); | ||
)(); | |||
</syntaxhighlight> | </syntaxhighlight> | ||
[ | == Related content == | ||
=== Forum topics === | |||
* [http://forum.flightgear.org/viewtopic.php?f=6&t=28020 version checking for matching fgfs and -set.xml files] |