Codechange: Store station layout tiles as std::span.
Using std::span provides both the start and end of the list, which allows validating that the requested layout is in range.
This commit is contained in:
committed by
Peter Nelson
parent
70a2ed062d
commit
d08636c841
@@ -3008,9 +3008,17 @@ static CommandCost RemoveDock(TileIndex tile, DoCommandFlag flags)
|
||||
|
||||
#include "table/station_land.h"
|
||||
|
||||
/**
|
||||
* Get station tile layout for a station type and its station gfx.
|
||||
* @param st Station type to draw.
|
||||
* @param gfx StationGfx of tile to draw.
|
||||
* @return Tile layout to draw.
|
||||
*/
|
||||
const DrawTileSprites *GetStationTileLayout(StationType st, uint8_t gfx)
|
||||
{
|
||||
return &_station_display_datas[st][gfx];
|
||||
const auto &layouts = _station_display_datas[st];
|
||||
if (gfx >= layouts.size()) gfx &= 1;
|
||||
return layouts.data() + gfx;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user