Show forbidden areas when funding industry

--HG--
branch : industry-allowed-highlight
This commit is contained in:
Pavel Stupnikov
2015-03-19 02:46:39 +03:00
parent cb4e363ad4
commit 6e6238c90b
9 changed files with 109 additions and 0 deletions
+33
View File
@@ -182,6 +182,21 @@ static const NWidgetPart _nested_build_industry_widgets[] = {
EndContainer(),
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_DPI_INFOPANEL), SetResize(1, 0),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetResize(1, 0),
NWidget(NWID_HORIZONTAL), SetPIP(2, 0, 2),
NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetMinimalSize(140, 14), SetDataTip(STR_FUND_INDUSTRY_FORBIDDEN_TILES_TITLE, STR_NULL),
NWidget(NWID_SPACER), SetFill(1, 0),
EndContainer(),
NWidget(NWID_HORIZONTAL), SetPIP(2, 0, 2),
NWidget(NWID_SPACER), SetFill(1, 0),
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_DPI_FT_OFF), SetMinimalSize(60, 12),
SetDataTip(STR_FUND_INDUSTRY_FORBIDDEN_TILES_OFF, STR_FUND_INDUSTRY_FORBIDDEN_TILES_OFF_TOOLTIP),
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_DPI_FT_ON), SetMinimalSize(60, 12),
SetDataTip(STR_FUND_INDUSTRY_FORBIDDEN_TILES_ON, STR_FUND_INDUSTRY_FORBIDDEN_TILES_ON_TOOLTIP),
NWidget(NWID_SPACER), SetFill(1, 0),
EndContainer(),
NWidget(NWID_SPACER), SetMinimalSize(0, 2),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_TEXTBTN, COLOUR_DARK_GREEN, WID_DPI_DISPLAY_WIDGET), SetFill(1, 0), SetResize(1, 0),
SetDataTip(STR_INDUSTRY_DISPLAY_CHAIN, STR_INDUSTRY_DISPLAY_CHAIN_TOOLTIP),
@@ -248,6 +263,7 @@ class BuildIndustryWindow : public Window {
if (this->selected_index == -1) {
this->selected_index = 0;
this->selected_type = this->index[0];
SetIndustryForbiddenTilesHighlight(this->selected_type);
}
this->vscroll->SetCount(this->count);
@@ -272,11 +288,17 @@ public:
this->CreateNestedTree();
this->vscroll = this->GetScrollbar(WID_DPI_SCROLLBAR);
this->LowerWidget(_settings_client.gui.show_industry_forbidden_tiles + WID_DPI_FT_OFF);
this->FinishInitNested(0);
this->SetButtons();
}
~BuildIndustryWindow()
{
SetIndustryForbiddenTilesHighlight(INVALID_INDUSTRYTYPE);
}
virtual void OnInit()
{
this->SetupArrays();
@@ -486,6 +508,7 @@ public:
if (y < this->count) { // Is it within the boundaries of available data?
this->selected_index = y;
this->selected_type = this->index[y];
SetIndustryForbiddenTilesHighlight(this->selected_type);
const IndustrySpec *indsp = (this->selected_type == INVALID_INDUSTRYTYPE) ? NULL : GetIndustrySpec(this->selected_type);
this->SetDirty();
@@ -529,6 +552,16 @@ public:
}
break;
}
case WID_DPI_FT_OFF:
case WID_DPI_FT_ON:
this->RaiseWidget(_settings_client.gui.show_industry_forbidden_tiles + WID_DPI_FT_OFF);
_settings_client.gui.show_industry_forbidden_tiles = (widget != WID_DPI_FT_OFF);
this->LowerWidget(_settings_client.gui.show_industry_forbidden_tiles + WID_DPI_FT_OFF);
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
this->SetDirty();
MarkWholeScreenDirty();
break;
}
}