Debug: Allow inspecting industry specs before industry is built

Add debug box to industry chains window
This commit is contained in:
Jonathan G Rennison
2022-08-10 21:35:33 +01:00
parent c58b94c376
commit 4e5e85e7aa
4 changed files with 96 additions and 45 deletions

View File

@@ -1887,6 +1887,7 @@ static const NWidgetPart _nested_industry_cargoes_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
NWidget(WWT_CAPTION, COLOUR_BROWN, WID_IC_CAPTION), SetDataTip(STR_INDUSTRY_CARGOES_INDUSTRY_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
NWidget(WWT_DEBUGBOX, COLOUR_BROWN, WID_IC_DEBUG),
NWidget(WWT_SHADEBOX, COLOUR_BROWN),
NWidget(WWT_DEFSIZEBOX, COLOUR_BROWN),
NWidget(WWT_STICKYBOX, COLOUR_BROWN),
@@ -2856,6 +2857,7 @@ struct IndustryCargoesWindow : public Window {
this->vscroll->SetCount(num_indrows);
this->SetDirty();
this->NotifySmallmap();
this->SetWidgetDisabledState(WID_IC_DEBUG, false);
}
/**
@@ -2927,6 +2929,7 @@ struct IndustryCargoesWindow : public Window {
this->vscroll->SetCount(num_indrows);
this->SetDirty();
this->NotifySmallmap();
this->SetWidgetDisabledState(WID_IC_DEBUG, true);
}
/**
@@ -3195,6 +3198,18 @@ struct IndustryCargoesWindow : public Window {
{
this->vscroll->SetCapacityFromWidget(this, WID_IC_PANEL, WD_FRAMERECT_TOP + CargoesField::small_height);
}
bool IsNewGRFInspectable() const override
{
return true;
}
void ShowNewGRFInspectWindow() const override
{
if (this->ind_cargo < NUM_INDUSTRYTYPES) {
::ShowNewGRFInspectWindow(GSF_INDUSTRIES, this->ind_cargo | (1 << 26));
}
}
};
const int IndustryCargoesWindow::HOR_TEXT_PADDING = 5; ///< Horizontal padding around the industry type text.