Debug: Add sprite dump button to industry debug window
This commit is contained in:
@@ -690,3 +690,8 @@ bool IndustryTemporarilyRefusesCargo(Industry *ind, CargoID cargo_type)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void DumpIndustrySpriteGroup(const IndustrySpec *spec, std::function<void(const char *)> print)
|
||||
{
|
||||
DumpSpriteGroup(spec->grf_prop.spritegroup[0], std::move(print));
|
||||
}
|
||||
|
@@ -727,6 +727,7 @@ static const NIVariable _niv_industries[] = {
|
||||
class NIHIndustry : public NIHelper {
|
||||
bool IsInspectable(uint index) const override { return true; }
|
||||
bool ShowExtraInfoOnly(uint index) const override { return GetIndustrySpec(Industry::Get(index)->type)->grf_prop.grffile == nullptr; }
|
||||
bool ShowSpriteDumpButton(uint index) const override { return true; }
|
||||
uint GetParent(uint index) const override { return GetInspectWindowNumber(GSF_FAKE_TOWNS, Industry::Get(index)->town->index); }
|
||||
const void *GetInstance(uint index)const override { return Industry::Get(index); }
|
||||
const void *GetSpec(uint index) const override { return GetIndustrySpec(Industry::Get(index)->type); }
|
||||
@@ -805,6 +806,15 @@ class NIHIndustry : public NIHelper {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* virtual */ void SpriteDump(uint index, std::function<void(const char *)> print) const override
|
||||
{
|
||||
const Industry *ind = Industry::GetIfValid(index);
|
||||
if (ind) {
|
||||
extern void DumpIndustrySpriteGroup(const IndustrySpec *spec, std::function<void(const char *)> print);
|
||||
DumpIndustrySpriteGroup(GetIndustrySpec(ind->type), std::move(print));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static const NIFeature _nif_industry = {
|
||||
|
Reference in New Issue
Block a user