From 010bd8c1459dd605d6294a0aa86f53eb4181eca0 Mon Sep 17 00:00:00 2001 From: Stuart Buchanan Date: Thu, 19 Nov 2020 18:44:00 +0000 Subject: [PATCH] Fix props.condition Previously props.condition threw an error if any of the properties in the condition were not defines. This is contrary to the behaviour of SGCondition, which it seeks to emulate, which considers such undefined properties as having the value 0.0. Now this is the case. This function only appears to be used by tutorials.nas, where this behaviour was seen as discrepancy between the checklist behaviour and the tutorial behaviour. See https://sourceforge.net/p/flightgear/codetickets/2394/?page=1 --- Nasal/props.nas | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Nasal/props.nas b/Nasal/props.nas index 31ce8108b..7578f4f11 100644 --- a/Nasal/props.nas +++ b/Nasal/props.nas @@ -452,11 +452,10 @@ var _cond_cmp = func(p, op) { return nil; } } - if(left == nil or right == nil) { - logprint(LOG_ALERT, "condition: comparing with nil"); - dump(p); - return nil; - } + + if (left == nil) left = 0.0; + if (right == nil) right = 0.0; + if(op < 0) return left < right; if(op > 0) return left > right; return left == right;