Codechange: Validate custom station platform layout tiles are permitted values only.
(cherry picked from commit 756034fa27
)
This commit is contained in:

committed by
Jonathan G Rennison

parent
da571d6481
commit
01d40812fa
@@ -2026,6 +2026,14 @@ static ChangeInfoResult StationChangeInfo(uint stid, int numinfo, int prop, cons
|
|||||||
|
|
||||||
const byte *layout = buf->ReadBytes(length * number);
|
const byte *layout = buf->ReadBytes(length * number);
|
||||||
statspec->layouts[length - 1][number - 1].assign(layout, layout + 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. */
|
||||||
|
for (auto &tile : statspec->layouts[length - 1][number - 1]) {
|
||||||
|
if ((tile & 6) != tile) {
|
||||||
|
grfmsg(1, "StationChangeInfo: Invalid tile %u in layout %ux%u", tile, length, number);
|
||||||
|
tile &= 6;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user