Debug: Add drop-down items to go between road/rail/signal features

This commit is contained in:
Jonathan G Rennison 2023-12-30 13:56:37 +00:00
parent dac4d9a221
commit 099a7bdd3a

View File

@ -1438,6 +1438,25 @@ class NIHSignals : public NIHelper {
extern void DumpNewSignalsSpriteGroups(SpriteGroupDumper &dumper);
DumpNewSignalsSpriteGroups(dumper);
}
/* virtual */ bool ShowOptionsDropDown(uint index) const override
{
return true;
}
/* virtual */ void FillOptionsDropDown(uint index, DropDownList &list) const override
{
list.push_back(std::make_unique<DropDownListStringItem>(STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE, 0, !IsTileType(index, MP_RAILWAY)));
}
/* virtual */ void OnOptionsDropdownSelect(uint index, int selected) const override
{
switch (selected) {
case 0:
ShowNewGRFInspectWindow(GSF_RAILTYPES, index);
break;
}
}
};
static const NIFeature _nif_signals = {
@ -1706,6 +1725,30 @@ class NIHRailType : public NIHelper {
extern void DumpRailTypeSpriteGroup(RailType rt, SpriteGroupDumper &dumper);
DumpRailTypeSpriteGroup(GetTileRailType(index), dumper);
}
/* virtual */ bool ShowOptionsDropDown(uint index) const override
{
return true;
}
/* virtual */ void FillOptionsDropDown(uint index, DropDownList &list) const override
{
list.push_back(std::make_unique<DropDownListStringItem>(STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE, 0, !IsLevelCrossingTile(index)));
list.push_back(std::make_unique<DropDownListStringItem>(STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_SIGNALS, 1, !(IsTileType(index, MP_RAILWAY) && HasSignals(index))));
}
/* virtual */ void OnOptionsDropdownSelect(uint index, int selected) const override
{
switch (selected) {
case 0:
ShowNewGRFInspectWindow(GSF_ROADTYPES, index);
break;
case 1:
ShowNewGRFInspectWindow(GSF_SIGNALS, index);
break;
}
}
};
static const NIFeature _nif_railtype = {
@ -2162,6 +2205,25 @@ class NIHRoadType : public NIHelper {
DumpRoadTypeSpriteGroup(rt, dumper);
}
}
/* virtual */ bool ShowOptionsDropDown(uint index) const override
{
return true;
}
/* virtual */ void FillOptionsDropDown(uint index, DropDownList &list) const override
{
list.push_back(std::make_unique<DropDownListStringItem>(STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE, 0, !IsLevelCrossingTile(index)));
}
/* virtual */ void OnOptionsDropdownSelect(uint index, int selected) const override
{
switch (selected) {
case 0:
ShowNewGRFInspectWindow(GSF_RAILTYPES, index);
break;
}
}
};
static const NIFeature _nif_roadtype = {