1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-16 17:02:37 +01:00

Add: Show count of towns and industries in their directory window captions. (#12800)

These windows now show "(<visible> of <total>)" in the caption.
This commit is contained in:
Peter Nelson
2024-06-23 17:55:37 +01:00
committed by GitHub
parent 7116f143d5
commit e802c1a97f
5 changed files with 16 additions and 4 deletions

View File

@@ -1233,7 +1233,7 @@ void ShowIndustryViewWindow(int industry)
static constexpr NWidgetPart _nested_industry_directory_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_INDUSTRY_DIRECTORY_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
NWidget(WWT_CAPTION, COLOUR_BROWN, WID_ID_CAPTION), SetDataTip(STR_INDUSTRY_DIRECTORY_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
NWidget(WWT_SHADEBOX, COLOUR_BROWN),
NWidget(WWT_DEFSIZEBOX, COLOUR_BROWN),
NWidget(WWT_STICKYBOX, COLOUR_BROWN),
@@ -1667,6 +1667,11 @@ public:
void SetStringParameters(WidgetID widget) const override
{
switch (widget) {
case WID_ID_CAPTION:
SetDParam(0, this->vscroll->GetCount());
SetDParam(1, Industry::GetNumItems());
break;
case WID_ID_DROPDOWN_CRITERIA:
SetDParam(0, IndustryDirectoryWindow::sorter_names[this->industries.SortType()]);
break;