Debug: Add sprite dump support to NewGRF objects
This commit is contained in:
@@ -566,3 +566,8 @@ void TriggerObjectAnimation(Object *o, ObjectAnimationTrigger trigger, const Obj
|
|||||||
TriggerObjectTileAnimation(o, tile, trigger, spec);
|
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 {
|
class NIHObject : public NIHelper {
|
||||||
bool IsInspectable(uint index) const override { return ObjectSpec::GetByTile(index)->grf_prop.grffile != nullptr; }
|
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); }
|
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 *GetInstance(uint index)const override { return Object::GetByTile(index); }
|
||||||
const void *GetSpec(uint index) const override { return ObjectSpec::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 = {
|
static const NIFeature _nif_object = {
|
||||||
|
Reference in New Issue
Block a user