mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-22 11:44:17 +01:00
Codechange: Make TileLayoutSpriteGroup::ProcessRegisters return a DrawTileSpriteSpan on the stack, instead of a reference to a global.
This commit is contained in:
@@ -444,11 +444,11 @@ uint16_t GetObjectCallback(CallbackID callback, uint32_t param1, uint32_t param2
|
||||
*/
|
||||
static void DrawTileLayout(const TileInfo *ti, const TileLayoutSpriteGroup *group, const ObjectSpec *spec)
|
||||
{
|
||||
const DrawTileSprites *dts = group->ProcessRegisters(nullptr);
|
||||
auto dts = group->ProcessRegisters(nullptr);
|
||||
PaletteID palette = (spec->flags.Test(ObjectFlag::Uses2CC) ? SPR_2CCMAP_BASE : PALETTE_RECOLOUR_START) + Object::GetByTile(ti->tile)->colour;
|
||||
|
||||
SpriteID image = dts->ground.sprite;
|
||||
PaletteID pal = dts->ground.pal;
|
||||
SpriteID image = dts.ground.sprite;
|
||||
PaletteID pal = dts.ground.pal;
|
||||
|
||||
if (GB(image, 0, SPRITE_WIDTH) != 0) {
|
||||
/* If the ground sprite is the default flat water sprite, draw also canal/river borders
|
||||
@@ -460,7 +460,7 @@ static void DrawTileLayout(const TileInfo *ti, const TileLayoutSpriteGroup *grou
|
||||
}
|
||||
}
|
||||
|
||||
DrawNewGRFTileSeq(ti, dts, TO_STRUCTURES, 0, palette);
|
||||
DrawNewGRFTileSeq(ti, &dts, TO_STRUCTURES, 0, palette);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -492,7 +492,7 @@ void DrawNewObjectTileInGUI(int x, int y, const ObjectSpec *spec, uint8_t view)
|
||||
const auto *group = object.Resolve<TileLayoutSpriteGroup>();
|
||||
if (group == nullptr) return;
|
||||
|
||||
const DrawTileSprites *dts = group->ProcessRegisters(nullptr);
|
||||
auto dts = group->ProcessRegisters(nullptr);
|
||||
|
||||
PaletteID palette;
|
||||
if (Company::IsValidID(_local_company)) {
|
||||
@@ -508,14 +508,14 @@ void DrawNewObjectTileInGUI(int x, int y, const ObjectSpec *spec, uint8_t view)
|
||||
palette = spec->flags.Test(ObjectFlag::Uses2CC) ? SPR_2CCMAP_BASE : PALETTE_RECOLOUR_START;
|
||||
}
|
||||
|
||||
SpriteID image = dts->ground.sprite;
|
||||
PaletteID pal = dts->ground.pal;
|
||||
SpriteID image = dts.ground.sprite;
|
||||
PaletteID pal = dts.ground.pal;
|
||||
|
||||
if (GB(image, 0, SPRITE_WIDTH) != 0) {
|
||||
DrawSprite(image, GroundSpritePaletteTransform(image, pal, palette), x, y);
|
||||
}
|
||||
|
||||
DrawNewGRFTileSeqInGUI(x, y, dts, 0, palette);
|
||||
DrawNewGRFTileSeqInGUI(x, y, &dts, 0, palette);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user