File diff r7996:5a693b9539fb → r7997:7eff37796679
src/industry_gui.cpp
Show inline comments
 
@@ -131,49 +131,49 @@ static void BuildDynamicIndustryWndProc(
 

	
 
			/* first indutry type is selected.
 
			 * I'll be damned if there are none available ;) */
 
			WP(w, fnd_d).index = 0;
 
			WP(w, fnd_d).select = _fund_gui.index[0];
 
			WP(w, fnd_d).callback_timer = DAY_TICKS;
 
		} break;
 

	
 
		case WE_PAINT: {
 
			const IndustrySpec *indsp = (WP(w, fnd_d).select == INVALID_INDUSTRYTYPE) ? NULL : GetIndustrySpec(WP(w, fnd_d).select);
 
			int x_str = w->widget[DYNA_INDU_INFOPANEL].left + 3;
 
			int y_str = w->widget[DYNA_INDU_INFOPANEL].top + 3;
 
			const Widget *wi = &w->widget[DYNA_INDU_INFOPANEL];
 
			int max_width = wi->right - wi->left - 4;
 

	
 
			/* Raw industries might be prospected. Show this fact by changing the string
 
			 * In Editor, you just build, while ingame, or you fund or you prospect */
 
			if (_game_mode == GM_EDITOR) {
 
				/* We've chosen many random industries but no industries have been specified */
 
				if (indsp == NULL) _fund_gui.enabled[WP(w, fnd_d).index] = _opt.diff.number_industries != 0;
 
				w->widget[DYNA_INDU_FUND_WIDGET].data = STR_BUILD_NEW_INDUSTRY;
 
			} else {
 
				w->widget[DYNA_INDU_FUND_WIDGET].data = (_patches.raw_industry_construction == 2 && indsp->IsRawIndustry()) ? STR_PROSPECT_NEW_INDUSTRY : STR_FUND_NEW_INDUSTRY;
 
			}
 
			SetWindowWidgetDisabledState(w, DYNA_INDU_FUND_WIDGET, !_fund_gui.enabled[WP(w, fnd_d).index]);
 
			w->SetWidgetDisabledState(DYNA_INDU_FUND_WIDGET, !_fund_gui.enabled[WP(w, fnd_d).index]);
 

	
 
			SetVScrollCount(w, _fund_gui.count);
 

	
 
			DrawWindowWidgets(w);
 

	
 
			/* and now with the matrix painting */
 
			for (byte i = 0; i < w->vscroll.cap && ((i + w->vscroll.pos) < _fund_gui.count); i++) {
 
				int offset = i * 13;
 
				int x = 3;
 
				int y = 16;
 
				bool selected = WP(w, fnd_d).index == i + w->vscroll.pos;
 

	
 
				if (_fund_gui.index[i + w->vscroll.pos] == INVALID_INDUSTRYTYPE) {
 
					DrawStringTruncated(20, y + offset, STR_MANY_RANDOM_INDUSTRIES, selected ? TC_WHITE : TC_ORANGE, max_width - 25);
 
					continue;
 
				}
 
				const IndustrySpec *indsp = GetIndustrySpec(_fund_gui.index[i + w->vscroll.pos]);
 

	
 
				/* Draw the name of the industry in white is selected, otherwise, in orange */
 
				DrawStringTruncated(20, y + offset, indsp->name, selected ? TC_WHITE : TC_ORANGE, max_width - 25);
 
				GfxFillRect(x,     y + 1 + offset,  x + 10, y + 7 + offset, selected ? 15 : 0);
 
				GfxFillRect(x + 1, y + 2 + offset,  x +  9, y + 6 + offset, indsp->map_colour);
 
			}