src/industry_gui.cpp
changeset 9354 845e07db4549
parent 9352 8979e416b2e9
child 9358 2e1e4d2f71dd
equal deleted inserted replaced
9353:9d76aef9fe2b 9354:845e07db4549
   129 			indsp = GetIndustrySpec(ind);
   129 			indsp = GetIndustrySpec(ind);
   130 			if (indsp->enabled){
   130 			if (indsp->enabled){
   131 				/* Rule is that editor mode loads all industries.
   131 				/* Rule is that editor mode loads all industries.
   132 				 * In game mode, all non raw industries are loaded too
   132 				 * In game mode, all non raw industries are loaded too
   133 				 * and raw ones are loaded only when setting allows it */
   133 				 * and raw ones are loaded only when setting allows it */
   134 				if (_game_mode != GM_EDITOR && indsp->IsRawIndustry() && _patches.raw_industry_construction == 0) {
   134 				if (_game_mode != GM_EDITOR && indsp->IsRawIndustry() && _settings.construction.raw_industry_construction == 0) {
   135 					/* Unselect if the industry is no longer in the list */
   135 					/* Unselect if the industry is no longer in the list */
   136 					if (this->selected_type == ind) this->selected_index = -1;
   136 					if (this->selected_type == ind) this->selected_index = -1;
   137 					continue;
   137 					continue;
   138 				}
   138 				}
   139 				this->index[this->count] = ind;
   139 				this->index[this->count] = ind;
   196 		if (_game_mode == GM_EDITOR) {
   196 		if (_game_mode == GM_EDITOR) {
   197 			/* We've chosen many random industries but no industries have been specified */
   197 			/* We've chosen many random industries but no industries have been specified */
   198 			if (indsp == NULL) this->enabled[this->selected_index] = _opt.diff.number_industries != 0;
   198 			if (indsp == NULL) this->enabled[this->selected_index] = _opt.diff.number_industries != 0;
   199 			this->widget[DPIW_FUND_WIDGET].data = STR_BUILD_NEW_INDUSTRY;
   199 			this->widget[DPIW_FUND_WIDGET].data = STR_BUILD_NEW_INDUSTRY;
   200 		} else {
   200 		} else {
   201 			this->widget[DPIW_FUND_WIDGET].data = (_patches.raw_industry_construction == 2 && indsp->IsRawIndustry()) ? STR_PROSPECT_NEW_INDUSTRY : STR_FUND_NEW_INDUSTRY;
   201 			this->widget[DPIW_FUND_WIDGET].data = (_settings.construction.raw_industry_construction == 2 && indsp->IsRawIndustry()) ? STR_PROSPECT_NEW_INDUSTRY : STR_FUND_NEW_INDUSTRY;
   202 		}
   202 		}
   203 		this->SetWidgetDisabledState(DPIW_FUND_WIDGET, !this->enabled[this->selected_index]);
   203 		this->SetWidgetDisabledState(DPIW_FUND_WIDGET, !this->enabled[this->selected_index]);
   204 
   204 
   205 		SetVScrollCount(this, this->count);
   205 		SetVScrollCount(this, this->count);
   206 
   206 
   302 					this->selected_type = this->index[y];
   302 					this->selected_type = this->index[y];
   303 					indsp = (this->selected_type == INVALID_INDUSTRYTYPE) ? NULL : GetIndustrySpec(this->selected_type);
   303 					indsp = (this->selected_type == INVALID_INDUSTRYTYPE) ? NULL : GetIndustrySpec(this->selected_type);
   304 
   304 
   305 					this->SetDirty();
   305 					this->SetDirty();
   306 
   306 
   307 					if ((_game_mode != GM_EDITOR && _patches.raw_industry_construction == 2 && indsp != NULL && indsp->IsRawIndustry()) ||
   307 					if ((_game_mode != GM_EDITOR && _settings.construction.raw_industry_construction == 2 && indsp != NULL && indsp->IsRawIndustry()) ||
   308 							this->selected_type == INVALID_INDUSTRYTYPE) {
   308 							this->selected_type == INVALID_INDUSTRYTYPE) {
   309 						/* Reset the button state if going to prospecting or "build many industries" */
   309 						/* Reset the button state if going to prospecting or "build many industries" */
   310 						this->RaiseButtons();
   310 						this->RaiseButtons();
   311 						ResetObjectToPlace();
   311 						ResetObjectToPlace();
   312 					}
   312 					}
   323 						extern void GenerateIndustries();
   323 						extern void GenerateIndustries();
   324 						_generating_world = true;
   324 						_generating_world = true;
   325 						GenerateIndustries();
   325 						GenerateIndustries();
   326 						_generating_world = false;
   326 						_generating_world = false;
   327 					}
   327 					}
   328 				} else if (_game_mode != GM_EDITOR && _patches.raw_industry_construction == 2 && GetIndustrySpec(this->selected_type)->IsRawIndustry()) {
   328 				} else if (_game_mode != GM_EDITOR && _settings.construction.raw_industry_construction == 2 && GetIndustrySpec(this->selected_type)->IsRawIndustry()) {
   329 					DoCommandP(0, this->selected_type, InteractiveRandom(), NULL, CMD_BUILD_INDUSTRY | CMD_MSG(STR_4830_CAN_T_CONSTRUCT_THIS_INDUSTRY));
   329 					DoCommandP(0, this->selected_type, InteractiveRandom(), NULL, CMD_BUILD_INDUSTRY | CMD_MSG(STR_4830_CAN_T_CONSTRUCT_THIS_INDUSTRY));
   330 					this->HandleButtonClick(DPIW_FUND_WIDGET);
   330 					this->HandleButtonClick(DPIW_FUND_WIDGET);
   331 				} else {
   331 				} else {
   332 					HandlePlacePushButton(this, DPIW_FUND_WIDGET, SPR_CURSOR_INDUSTRY, VHM_RECT, NULL);
   332 					HandlePlacePushButton(this, DPIW_FUND_WIDGET, SPR_CURSOR_INDUSTRY, VHM_RECT, NULL);
   333 				}
   333 				}