Feature: [NewGRF] Allow fixed layout up to 256 tiles per NewGRF rail station.

Allow using up to 256 tile layouts in property 0E or callback 24, which defines the layout to be saved into the map.

This was originally limited to 8, because station graphics above 8 referred to other station types but that was changed in 2007.

1) More efficient than using callback 14, as that needs to be checked every time a station tile is rendered.
2) The layout does not get changed when the station is changed (this may or may not be desirable!)

Using more than 256 layouts still requires callback 14.
This commit is contained in:
Peter Nelson
2024-04-18 12:21:36 +01:00
committed by Peter Nelson
parent d08636c841
commit 6e553410d3
3 changed files with 5 additions and 5 deletions

View File

@@ -2048,11 +2048,11 @@ static ChangeInfoResult StationChangeInfo(uint stid, int numinfo, int prop, Byte
const uint8_t *layout = buf.ReadBytes(length * number);
statspec->layouts[length - 1][number - 1].assign(layout, layout + length * number);
/* Validate tile values are only the permitted 00, 02, 04 and 06. */
/* Ensure the first bit, axis, is zero. The rest of the value is validated during rendering, as we don't know the range yet. */
for (auto &tile : statspec->layouts[length - 1][number - 1]) {
if ((tile & 6) != tile) {
if ((tile & ~1U) != tile) {
GrfMsg(1, "StationChangeInfo: Invalid tile {} in layout {}x{}", tile, length, number);
tile &= 6;
tile &= ~1U;
}
}
}