1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-23 20:24:12 +01:00

Codechange: Move SpriteGroup cast from callers into Resolve.

This commit is contained in:
frosch
2025-04-28 15:58:35 +02:00
committed by frosch
parent af25eecc15
commit 010b944173
15 changed files with 59 additions and 50 deletions

View File

@@ -473,10 +473,10 @@ void DrawNewObjectTile(TileInfo *ti, const ObjectSpec *spec)
Object *o = Object::GetByTile(ti->tile);
ObjectResolverObject object(spec, o, ti->tile);
const SpriteGroup *group = object.Resolve();
if (group == nullptr || group->type != SGT_TILELAYOUT) return;
const auto *group = object.Resolve<TileLayoutSpriteGroup>();
if (group == nullptr) return;
DrawTileLayout(ti, (const TileLayoutSpriteGroup *)group, spec);
DrawTileLayout(ti, group, spec);
}
/**
@@ -489,10 +489,10 @@ void DrawNewObjectTile(TileInfo *ti, const ObjectSpec *spec)
void DrawNewObjectTileInGUI(int x, int y, const ObjectSpec *spec, uint8_t view)
{
ObjectResolverObject object(spec, nullptr, INVALID_TILE, view);
const SpriteGroup *group = object.Resolve();
if (group == nullptr || group->type != SGT_TILELAYOUT) return;
const auto *group = object.Resolve<TileLayoutSpriteGroup>();
if (group == nullptr) return;
const DrawTileSprites *dts = ((const TileLayoutSpriteGroup *)group)->ProcessRegisters(nullptr);
const DrawTileSprites *dts = group->ProcessRegisters(nullptr);
PaletteID palette;
if (Company::IsValidID(_local_company)) {