From d807570a4361364fd1a7fe83400f843d539569ab Mon Sep 17 00:00:00 2001 From: Tobias Dammers Date: Tue, 12 Apr 2022 15:36:09 +0200 Subject: [PATCH] Bugfix: make it work on FG `next` The problem was that `next` changes the way strings are coerced to booleans when calling `getBoolValue()` on properties. On FG 2020.3, the string "0" is first converted to integer, which gives 0, and then to boolean, which keeps it as 0 (false). On FG Next, "0" is interpreted as a non-empty string, and directly converted to boolean as 1 (true). --- addon-main.nas | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addon-main.nas b/addon-main.nas index f9e5e3c..b063723 100644 --- a/addon-main.nas +++ b/addon-main.nas @@ -100,7 +100,7 @@ var toFlightplan = func (ofp, fp=nil) { var sidID = nil; var starID = nil; foreach (var ofpFix; ofpFixes) { - if (ofpFix.getNode('is_sid_star').getBoolValue()) { + if (ofpFix.getNode('is_sid_star').getValue() == 1) { if ((ofpFix.getValue('stage') == 'CLB') and (getprop('/sim/simbrief/options/import-departure') or 0) and (sidID == nil)) { @@ -159,6 +159,7 @@ var toFlightplan = func (ofp, fp=nil) { # we have everything we need; it's now safe-ish to overwrite or # create the actual flightplan + if (fp == nil) { fp = createFlightplan(); }