OpenTTD / nml

NewGRF Meta Language
GNU General Public License v2.0
42 stars 36 forks source link

Change: Unreachable range for default only switch should target CB_FAILED #328

Closed JGRennison closed 2 months ago

JGRennison commented 4 months ago

The unreachable range for default only switches should target the CB_FAILED group, instead of returning a success value of 0.

This is because the current success value of 0 interacts unfavourably with other unfortunate quirks of the GRF spec and how callbacks are handled.

The result of this is that a switch which can trigger a variable error in the graphics chain can result in unrelated callbacks inexplicably succeeding with a value of 0. In the case of callback 36 this can lead to all sorts of weird behaviour. This PR changes this behaviour to the callbacks returning a failure result as expected.