diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index 89a6226d92..f91696de0c 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -215,6 +215,7 @@ class BuildIndustryWindow : public Window { IndustryType index[NUM_INDUSTRYTYPES + 1]; ///< Type of industry, in the order it was loaded bool enabled[NUM_INDUSTRYTYPES + 1]; ///< availability state, coming from CBID_INDUSTRY_PROBABILITY (if ever) Scrollbar *vscroll; + bool funding_enabled; /** The offset for the text in the matrix. */ static const int MATRIX_TEXT_OFFSET = 17; @@ -267,13 +268,17 @@ class BuildIndustryWindow : public Window { } this->vscroll->SetCount(this->count); + + this->funding_enabled = (_game_mode == GM_EDITOR || Company::IsValidID(_local_company)); + fprintf(stderr, "%d\n", (int)Company::IsValidID(_local_company)); } /** Update status of the fund and display-chain widgets. */ void SetButtons() { - this->SetWidgetDisabledState(WID_DPI_FUND_WIDGET, this->selected_type != INVALID_INDUSTRYTYPE && !this->enabled[this->selected_index]); + this->SetWidgetDisabledState(WID_DPI_FUND_WIDGET, !this->funding_enabled || (this->selected_type != INVALID_INDUSTRYTYPE && !this->enabled[this->selected_index])); this->SetWidgetDisabledState(WID_DPI_DISPLAY_WIDGET, this->selected_type == INVALID_INDUSTRYTYPE && this->enabled[this->selected_index]); + this->LowerWidget(_settings_client.gui.show_industry_forbidden_tiles + WID_DPI_FT_OFF); } public: @@ -285,10 +290,10 @@ public: this->selected_type = INVALID_INDUSTRYTYPE; this->callback_timer = DAY_TICKS; + this->funding_enabled = false; 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(); @@ -681,7 +686,6 @@ static WindowDesc _build_industry_desc( void ShowBuildIndustryWindow() { - if (_game_mode != GM_EDITOR && !Company::IsValidID(_local_company)) return; if (BringWindowToFrontById(WC_BUILD_INDUSTRY, 0)) return; new BuildIndustryWindow(&_build_industry_desc); } diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp index 0f8cfb86bc..9a6dff46a5 100644 --- a/src/toolbar_gui.cpp +++ b/src/toolbar_gui.cpp @@ -786,7 +786,7 @@ static CallBackFunction MenuClickLeague(int index) static CallBackFunction ToolbarIndustryClick(Window *w) { /* Disable build-industry menu if we are a spectator */ - PopupMainToolbMenu(w, WID_TN_INDUSTRIES, STR_INDUSTRY_MENU_INDUSTRY_DIRECTORY, (_local_company == COMPANY_SPECTATOR) ? 2 : 3); + PopupMainToolbMenu(w, WID_TN_INDUSTRIES, STR_INDUSTRY_MENU_INDUSTRY_DIRECTORY, 3); return CBF_NONE; }