1
0
Fork 0

Fix #12395: Ensure president name widget is tall enough.

pull/12419/head
Peter Nelson 2024-04-04 17:05:22 +01:00
parent 338def1b06
commit 0ca1ad373a
No known key found for this signature in database
GPG Key ID: 8EF8F0A467DF75ED
2 changed files with 17 additions and 0 deletions

View File

@ -1182,6 +1182,7 @@ CommandCost CmdRenamePresident(DoCommandFlag flags, const std::string &text)
}
}
InvalidateWindowClassesData(WC_COMPANY, 1);
MarkWholeScreenDirty();
CompanyAdminUpdate(c);
}

View File

@ -2452,6 +2452,14 @@ struct CompanyWindow : Window
}
}
void OnResize() override
{
NWidgetResizeBase *wid = this->GetWidget<NWidgetResizeBase>(WID_C_FACE_TITLE);
SetDParam(0, this->owner);
int y = GetStringHeight(STR_COMPANY_VIEW_PRESIDENT_MANAGER_TITLE, wid->current_x);
if (wid->UpdateVerticalSize(y)) this->ReInit(0, 0);
}
void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
@ -2587,6 +2595,14 @@ struct CompanyWindow : Window
break;
}
}
void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
{
if (gui_scope && data == 1) {
/* Manually call OnResize to adjust minimum height of president name widget. */
OnResize();
}
}
};
static WindowDesc _company_desc(