Feature: Show the number of industries already built in the Fund New Industry window.

pull/532/head
Henry Wilson 1 year ago committed by rubidium42
parent a934a584a5
commit 3a03a12a9c

@ -207,6 +207,7 @@ Industry::~Industry()
void Industry::PostDestructor(size_t index) void Industry::PostDestructor(size_t index)
{ {
InvalidateWindowData(WC_INDUSTRY_DIRECTORY, 0, IDIWD_FORCE_REBUILD); InvalidateWindowData(WC_INDUSTRY_DIRECTORY, 0, IDIWD_FORCE_REBUILD);
SetWindowDirty(WC_BUILD_INDUSTRY, 0);
} }
@ -1942,6 +1943,7 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, IndustryType type,
for (uint j = 0; j != 50; j++) PlantRandomFarmField(i); for (uint j = 0; j != 50; j++) PlantRandomFarmField(i);
} }
InvalidateWindowData(WC_INDUSTRY_DIRECTORY, 0, IDIWD_FORCE_REBUILD); InvalidateWindowData(WC_INDUSTRY_DIRECTORY, 0, IDIWD_FORCE_REBUILD);
SetWindowDirty(WC_BUILD_INDUSTRY, 0);
if (!_generating_world) PopulateStationsNearby(i); if (!_generating_world) PopulateStationsNearby(i);
} }

@ -517,14 +517,16 @@ public:
icon.bottom = icon.top + this->legend.height - 1; icon.bottom = icon.top + this->legend.height - 1;
for (uint16 i = this->vscroll->GetPosition(); this->vscroll->IsVisible(i) && i < this->vscroll->GetCount(); i++) { for (uint16 i = this->vscroll->GetPosition(); this->vscroll->IsVisible(i) && i < this->vscroll->GetCount(); i++) {
bool selected = this->selected_type == this->list[i]; IndustryType type = this->list[i];
bool selected = this->selected_type == type;
const IndustrySpec *indsp = GetIndustrySpec(this->list[i]); const IndustrySpec *indsp = GetIndustrySpec(type);
/* Draw the name of the industry in white is selected, otherwise, in orange */ /* Draw the name of the industry in white is selected, otherwise, in orange */
DrawString(text, indsp->name, selected ? TC_WHITE : TC_ORANGE); DrawString(text, indsp->name, selected ? TC_WHITE : TC_ORANGE);
GfxFillRect(icon, selected ? PC_WHITE : PC_BLACK); GfxFillRect(icon, selected ? PC_WHITE : PC_BLACK);
GfxFillRect(icon.Shrink(WidgetDimensions::scaled.bevel), indsp->map_colour); GfxFillRect(icon.Shrink(WidgetDimensions::scaled.bevel), indsp->map_colour);
SetDParam(0, Industry::GetIndustryTypeCount(type));
DrawString(text, STR_JUST_COMMA, TC_BLACK, SA_RIGHT, false, FS_SMALL);
text = text.Translate(0, this->resize.step_height); text = text.Translate(0, this->resize.step_height);
icon = icon.Translate(0, this->resize.step_height); icon = icon.Translate(0, this->resize.step_height);

Loading…
Cancel
Save