1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-19 10:22:39 +01:00

Codechange: Move spritelayout preprocessing to a separate class, which owns the heap allocations involved.

This commit is contained in:
frosch
2025-05-05 18:36:44 +02:00
committed by frosch
parent d9c43e7fda
commit 8bbfbd0347
11 changed files with 90 additions and 68 deletions

View File

@@ -444,7 +444,8 @@ uint16_t GetObjectCallback(CallbackID callback, uint32_t param1, uint32_t param2
*/
static void DrawTileLayout(const TileInfo *ti, const TileLayoutSpriteGroup *group, const ObjectSpec *spec)
{
auto dts = group->ProcessRegisters(nullptr);
auto processor = group->ProcessRegisters(nullptr);
auto dts = processor.GetLayout();
PaletteID palette = (spec->flags.Test(ObjectFlag::Uses2CC) ? SPR_2CCMAP_BASE : PALETTE_RECOLOUR_START) + Object::GetByTile(ti->tile)->colour;
SpriteID image = dts.ground.sprite;
@@ -492,7 +493,8 @@ void DrawNewObjectTileInGUI(int x, int y, const ObjectSpec *spec, uint8_t view)
const auto *group = object.Resolve<TileLayoutSpriteGroup>();
if (group == nullptr) return;
auto dts = group->ProcessRegisters(nullptr);
auto processor = group->ProcessRegisters(nullptr);
auto dts = processor.GetLayout();
PaletteID palette;
if (Company::IsValidID(_local_company)) {