Curt wrote:
> It looks like /autopilot/locks/speed is a string field.  It appears
> that "" no longer equals 0.  My assumption when I wrote the script
> (hehe, I think I wrote that script, apologies to whoever if I
> didn't) was that for the comparison with zero, auto.getValue() would
> be converted to a compatible type before the comparison.  If this
> isn't the case, then I should probably test if auto.getValue() == ""
> instead ...

Heh, good catch.  You're right, this (probably) *was* exposed by the
recent changes.  The proximate bug was that the constant "" used to
have a numerical value of zero (which is incorrect and was fixed) and
was (probably) being folded together with another constant with a
value of 0 (like "0.0", or the actual number zero).

The real bug, though, was that "" does not have (and never had) a
*boolean* value of false, so the "or" operator (which used to be
getting a numerical zero, which is false) now sees it as true.

This is fixed in my Nasal tree (which has lots of new goodies*).  I'll
commit a patch to SimGear to fix it there too.

Andy

* It's about 3x faster, has optional named function arguments, local
  variable declarations, is properly tail recursive, and has grown by
  only about 20% or so in code size.  New release is pending as soon
  as I finish some library stuff, including a sprintf() wrapper.

_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d

Reply via email to