Debug: Add sprite dump support to NewGRF objects

pull/341/head
Jonathan G Rennison 3 years ago
parent 5d56d12bf3
commit 76fcfd3efd

@ -566,3 +566,8 @@ void TriggerObjectAnimation(Object *o, ObjectAnimationTrigger trigger, const Obj
TriggerObjectTileAnimation(o, tile, trigger, spec);
}
}
void DumpObjectSpriteGroup(const ObjectSpec *spec, std::function<void(const char *)> print)
{
DumpSpriteGroup(spec->grf_prop.spritegroup[0], std::move(print));
}

@ -837,6 +837,7 @@ static const NIVariable _niv_objects[] = {
class NIHObject : public NIHelper {
bool IsInspectable(uint index) const override { return ObjectSpec::GetByTile(index)->grf_prop.grffile != nullptr; }
bool ShowSpriteDumpButton(uint index) const override { return true; }
uint GetParent(uint index) const override { return GetInspectWindowNumber(GSF_FAKE_TOWNS, Object::GetByTile(index)->town->index); }
const void *GetInstance(uint index)const override { return Object::GetByTile(index); }
const void *GetSpec(uint index) const override { return ObjectSpec::GetByTile(index); }
@ -890,6 +891,12 @@ class NIHObject : public NIHelper {
}
}
}
/* virtual */ void SpriteDump(uint index, std::function<void(const char *)> print) const override
{
extern void DumpObjectSpriteGroup(const ObjectSpec *spec, std::function<void(const char *)> print);
DumpObjectSpriteGroup(ObjectSpec::GetByTile(index), std::move(print));
}
};
static const NIFeature _nif_object = {

Loading…
Cancel
Save