diff --git a/src/company_cmd.cpp b/src/company_cmd.cpp index 2f68a61817..a92ced1154 100644 --- a/src/company_cmd.cpp +++ b/src/company_cmd.cpp @@ -1182,6 +1182,7 @@ CommandCost CmdRenamePresident(DoCommandFlag flags, const std::string &text) } } + InvalidateWindowClassesData(WC_COMPANY, 1); MarkWholeScreenDirty(); CompanyAdminUpdate(c); } diff --git a/src/company_gui.cpp b/src/company_gui.cpp index a72569f1a9..27f014b408 100644 --- a/src/company_gui.cpp +++ b/src/company_gui.cpp @@ -2452,6 +2452,14 @@ struct CompanyWindow : Window } } + void OnResize() override + { + NWidgetResizeBase *wid = this->GetWidget(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(