Change: Disallow using Action A to load sprites above the baseset unless reserved. #12435
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation / Problem
Using Action A above the baseset is error prone as the sprites are not fixed and can be moved around.
Any NewGRF doing so is likely to break in the future, so force it to break instead.
The NewGRF specifications have always been very clear on this, but it seems authors are not reading the spec. https://newgrf-specs.tt-wiki.net/wiki/ActionA
There are some authors not properly reading the spec, and using Action A when they should be using Action 5. These NewGRFs do appear to work for them, but there's no guarantee they will continue to do so.
Description
When loading sprites via Action A, check if the sprite ID is either in the permitted range (below SPR_OPENTTD_BASE), or if the NewGRF has reserved some SpriteIDs via GRM reservation.
If these conditions are satisfied, the sprites are loaded at the requested location.
Otherwise the sprites are loaded at the current location so that they have no effect, and a warning debug is output. It might be possible to skip the sprites, but it seems a bit tricky as we are mid-way into the Action A here so the usual way isn't available.
This effectively "breaks" the NewGRF now, instead of at some possible time in the future when authors have moved on to other things.
Limitations
I know of at least one NewGRF that is affected by this change, There may be others, but hopefully anything old enough to be affected and unmaintained will have been broken for a while already...
There may be some other conditions I haven't considered where Action A is appropriate, but I can't think of any.
NewGRFs known to be affected by this change
Checklist for review
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.