Codechange: use std::vector/std::span for DrawTileSprites over malloc-ed table
This commit is contained in:
+5
-4
@@ -797,17 +797,18 @@ static void DrawCanalWater(TileIndex tile)
|
||||
* Draw a build sprite sequence for water tiles.
|
||||
* If buildings are invisible, nothing will be drawn.
|
||||
* @param ti Tile info.
|
||||
* @param dtss Sprite sequence to draw.
|
||||
* @param seq Sprite sequence to draw.
|
||||
* @param base Base sprite.
|
||||
* @param offset Additional sprite offset.
|
||||
* @param palette Palette to use.
|
||||
*/
|
||||
static void DrawWaterTileStruct(const TileInfo *ti, const DrawTileSeqStruct *dtss, SpriteID base, uint offset, PaletteID palette, CanalFeature feature)
|
||||
static void DrawWaterTileStruct(const TileInfo *ti, std::span<const DrawTileSeqStruct> seq, SpriteID base, uint offset, PaletteID palette, CanalFeature feature)
|
||||
{
|
||||
/* Don't draw if buildings are invisible. */
|
||||
if (IsInvisibilitySet(TO_BUILDINGS)) return;
|
||||
|
||||
for (; !dtss->IsTerminator(); dtss++) {
|
||||
const DrawTileSeqStruct *dtss;
|
||||
foreach_draw_tile_seq(dtss, seq) {
|
||||
uint tile_offs = offset + dtss->image.sprite;
|
||||
if (feature < CF_END) tile_offs = GetCanalSpriteOffset(feature, ti->tile, tile_offs);
|
||||
AddSortableSpriteToDraw(base + tile_offs, palette,
|
||||
@@ -854,7 +855,7 @@ static void DrawWaterLock(const TileInfo *ti)
|
||||
zoffs = ti->z > z_threshold ? 24 : 0;
|
||||
}
|
||||
|
||||
DrawWaterTileStruct(ti, dts.seq, base, zoffs, PAL_NONE, CF_LOCKS);
|
||||
DrawWaterTileStruct(ti, dts.GetSequence(), base, zoffs, PAL_NONE, CF_LOCKS);
|
||||
}
|
||||
|
||||
/** Draw a ship depot tile. */
|
||||
|
||||
Reference in New Issue
Block a user