Changeset - r27328:cc781146936e
[Not reviewed]
master
0 2 0
Henry Wilson - 19 months ago 2023-05-11 00:15:21
henry@henryandlizzy.uk
Feature: Show the number of industries already built in the Fund New Industry window.
2 files changed with 7 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/industry_cmd.cpp
Show inline comments
 
@@ -204,12 +204,13 @@ Industry::~Industry()
 
 * Invalidating some stuff after removing item from the pool.
 
 * @param index index of deleted item
 
 */
 
void Industry::PostDestructor(size_t index)
 
{
 
	InvalidateWindowData(WC_INDUSTRY_DIRECTORY, 0, IDIWD_FORCE_REBUILD);
 
	SetWindowDirty(WC_BUILD_INDUSTRY, 0);
 
}
 

	
 

	
 
/**
 
 * Return a random valid industry.
 
 * @return random industry, nullptr if there are no industries
 
@@ -1939,12 +1940,13 @@ static void DoCreateNewIndustry(Industry
 
	}
 

	
 
	if (GetIndustrySpec(i->type)->behaviour & INDUSTRYBEH_PLANT_ON_BUILT) {
 
		for (uint j = 0; j != 50; j++) PlantRandomFarmField(i);
 
	}
 
	InvalidateWindowData(WC_INDUSTRY_DIRECTORY, 0, IDIWD_FORCE_REBUILD);
 
	SetWindowDirty(WC_BUILD_INDUSTRY, 0);
 

	
 
	if (!_generating_world) PopulateStationsNearby(i);
 
}
 

	
 
/**
 
 * Helper function for Build/Fund an industry
src/industry_gui.cpp
Show inline comments
 
@@ -514,20 +514,22 @@ public:
 

	
 
				/* Vertical offset for legend icon. */
 
				icon.top    = r.top + (this->resize.step_height - this->legend.height + 1) / 2;
 
				icon.bottom = icon.top + this->legend.height - 1;
 

	
 
				for (uint16 i = this->vscroll->GetPosition(); this->vscroll->IsVisible(i) && i < this->vscroll->GetCount(); i++) {
 
					bool selected = this->selected_type == this->list[i];
 

	
 
					const IndustrySpec *indsp = GetIndustrySpec(this->list[i]);
 
					IndustryType type = this->list[i];
 
					bool selected = this->selected_type == type;
 
					const IndustrySpec *indsp = GetIndustrySpec(type);
 

	
 
					/* Draw the name of the industry in white is selected, otherwise, in orange */
 
					DrawString(text, indsp->name, selected ? TC_WHITE : TC_ORANGE);
 
					GfxFillRect(icon, selected ? PC_WHITE : PC_BLACK);
 
					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);
 
					icon = icon.Translate(0, this->resize.step_height);
 
				}
 
				break;
 
			}
0 comments (0 inline, 0 general)