OpenTTD / nml

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

`replacenew` of `PRE_SIGNAL` incorrectly requires 48 sprites #290

Closed zephyris closed 1 year ago

zephyris commented 1 year ago

The PRE_SIGNAL type for replacenew is documented as requiring 48 sprites, but does not indicate that all need to be replaced together. However, attempting to replace only a subset gives an error.

See also: https://newgrf-specs.tt-wiki.net/wiki/NML:Replace_new_sprites

replacenew (PRE_SIGNAL) { [] }

gives:

nmlc ERROR: "ogfx2e_extra.nml", line 1: Invalid sprite count for sprite replacement type 'PRE_SIGNAL', expected 48, got 1

Similar behaviour occurs with non-empty sprites. Tested using nml 0.7.2.

glx22 commented 1 year ago

I think you need to use PRE_SIGNAL_SEMAPHORE_PBS for offset usage.

zephyris commented 1 year ago

Perhaps it's just a documentation issue then, but it should be allowed according to the docs.

What's the difference between PRE_SIGNAL_SEMAPHORE_PBS and PRE_SIGNAL, beyond the obvious sprite number difference? I noticed that OpenGFX source uses PRE_SIGNAL and 48 sprites for the entry, exit and combo light (rather than semaphore) pre-signals. Can they just be put into offset 0 of PRE_SIGNAL_SEMAPHORE_PBS?

glx22 commented 1 year ago

It all comes from https://newgrf-specs.tt-wiki.net/wiki/Action5#type