1
0
Fork 0

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 <condition> behaviour and the tutorial
<condition> behaviour.

See https://sourceforge.net/p/flightgear/codetickets/2394/?page=1
This commit is contained in:
Stuart Buchanan 2020-11-19 18:44:00 +00:00
parent 37110ad34a
commit 010bd8c145

View file

@ -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;