You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some VA2 variables are "unavailable" in some contexts, often in the purchase list.
When a variable is "unavailable" it does not provide any default value, but rather "throws an exception".
In the "throw" case, the remaining computations in the current VA2 are aborted/not executed, and the "first" case is choosen. (in case of a computed result, the "default" case is choosen).
NML should not expose this surprising behavior as-it to NML users. Instead NML should explicitly "catch" this case:
Insert a first case that is unreachable otherwise (e.g. "range 1..0"). (not needed for "computed results")
Provide a sane default for the "error" case: "return CB_FAILED" seems reasonable.
Bonus: Add an "error: <expression>" similar to "default: <expression>" to switches, for user-defined error-handling.
Some VA2 variables are "unavailable" in some contexts, often in the purchase list.
When a variable is "unavailable" it does not provide any default value, but rather "throws an exception".
In the "throw" case, the remaining computations in the current VA2 are aborted/not executed, and the "first" case is choosen. (in case of a computed result, the "default" case is choosen).
NML should not expose this surprising behavior as-it to NML users. Instead NML should explicitly "catch" this case:
For details, see: https://github.com/OpenTTD/OpenTTD/blob/master/src/newgrf_spritegroup.cpp#L234 (DeterministicSpriteGroup::Resolve)
The text was updated successfully, but these errors were encountered: