Debug: Add sprite dump button to industry/station tile debug windows
This commit is contained in:
@@ -695,3 +695,8 @@ void DumpIndustrySpriteGroup(const IndustrySpec *spec, std::function<void(const
|
|||||||
{
|
{
|
||||||
DumpSpriteGroup(spec->grf_prop.spritegroup[0], std::move(print));
|
DumpSpriteGroup(spec->grf_prop.spritegroup[0], std::move(print));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DumpIndustryTileSpriteGroup(const IndustryTileSpec *spec, std::function<void(const char *)> print)
|
||||||
|
{
|
||||||
|
DumpSpriteGroup(spec->grf_prop.spritegroup[0], std::move(print));
|
||||||
|
}
|
||||||
|
@@ -453,6 +453,7 @@ static const NIVariable _niv_stations[] = {
|
|||||||
class NIHStation : public NIHelper {
|
class NIHStation : public NIHelper {
|
||||||
bool IsInspectable(uint index) const override { return GetStationSpec(index) != nullptr; }
|
bool IsInspectable(uint index) const override { return GetStationSpec(index) != nullptr; }
|
||||||
uint GetParent(uint index) const override { return GetInspectWindowNumber(GSF_FAKE_TOWNS, Station::GetByTile(index)->town->index); }
|
uint GetParent(uint index) const override { return GetInspectWindowNumber(GSF_FAKE_TOWNS, Station::GetByTile(index)->town->index); }
|
||||||
|
bool ShowSpriteDumpButton(uint index) const override { return true; }
|
||||||
const void *GetInstance(uint index)const override { return nullptr; }
|
const void *GetInstance(uint index)const override { return nullptr; }
|
||||||
const void *GetSpec(uint index) const override { return GetStationSpec(index); }
|
const void *GetSpec(uint index) const override { return GetStationSpec(index); }
|
||||||
void SetStringParameters(uint index) const override { this->SetObjectAtStringParameters(STR_STATION_NAME, GetStationIndex(index), index); }
|
void SetStringParameters(uint index) const override { this->SetObjectAtStringParameters(STR_STATION_NAME, GetStationIndex(index), index); }
|
||||||
@@ -463,6 +464,12 @@ class NIHStation : public NIHelper {
|
|||||||
StationResolverObject ro(GetStationSpec(index), Station::GetByTile(index), index, INVALID_RAILTYPE);
|
StationResolverObject ro(GetStationSpec(index), Station::GetByTile(index), index, INVALID_RAILTYPE);
|
||||||
return ro.GetScope(VSG_SCOPE_SELF)->GetVariable(var, param, extra);
|
return ro.GetScope(VSG_SCOPE_SELF)->GetVariable(var, param, extra);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* virtual */ void SpriteDump(uint index, std::function<void(const char *)> print) const override
|
||||||
|
{
|
||||||
|
StationResolverObject ro(GetStationSpec(index), Station::GetByTile(index), index, INVALID_RAILTYPE);
|
||||||
|
DumpSpriteGroup(ro.root_spritegroup, std::move(print));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static const NIFeature _nif_station = {
|
static const NIFeature _nif_station = {
|
||||||
@@ -601,6 +608,7 @@ static const NIVariable _niv_industrytiles[] = {
|
|||||||
|
|
||||||
class NIHIndustryTile : public NIHelper {
|
class NIHIndustryTile : public NIHelper {
|
||||||
bool IsInspectable(uint index) const override { return GetIndustryTileSpec(GetIndustryGfx(index))->grf_prop.grffile != nullptr; }
|
bool IsInspectable(uint index) const override { return GetIndustryTileSpec(GetIndustryGfx(index))->grf_prop.grffile != nullptr; }
|
||||||
|
bool ShowSpriteDumpButton(uint index) const override { return true; }
|
||||||
uint GetParent(uint index) const override { return GetInspectWindowNumber(GSF_INDUSTRIES, GetIndustryIndex(index)); }
|
uint GetParent(uint index) const override { return GetInspectWindowNumber(GSF_INDUSTRIES, GetIndustryIndex(index)); }
|
||||||
const void *GetInstance(uint index)const override { return nullptr; }
|
const void *GetInstance(uint index)const override { return nullptr; }
|
||||||
const void *GetSpec(uint index) const override { return GetIndustryTileSpec(GetIndustryGfx(index)); }
|
const void *GetSpec(uint index) const override { return GetIndustryTileSpec(GetIndustryGfx(index)); }
|
||||||
@@ -629,6 +637,15 @@ class NIHIndustryTile : public NIHelper {
|
|||||||
output.print(buffer);
|
output.print(buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* virtual */ void SpriteDump(uint index, std::function<void(const char *)> print) const override
|
||||||
|
{
|
||||||
|
const IndustryTileSpec *indts = GetIndustryTileSpec(GetIndustryGfx(index));
|
||||||
|
if (indts) {
|
||||||
|
extern void DumpIndustryTileSpriteGroup(const IndustryTileSpec *spec, std::function<void(const char *)> print);
|
||||||
|
DumpIndustryTileSpriteGroup(indts, std::move(print));
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static const NIFeature _nif_industrytile = {
|
static const NIFeature _nif_industrytile = {
|
||||||
|
Reference in New Issue
Block a user