From ef477b7dd78432bd2417d2526c5bc987ff7d3a39 Mon Sep 17 00:00:00 2001 From: frosch Date: Sat, 6 Mar 2010 16:26:09 +0000 Subject: (svn r19358) -Fix [FS#3663]: Close error messages about missing ownership when the company closes or is taken over. (parts by Alberth). --- src/company_cmd.cpp | 2 ++ src/misc_gui.cpp | 6 ++++++ 2 files changed, 8 insertions(+) (limited to 'src') diff --git a/src/company_cmd.cpp b/src/company_cmd.cpp index 5e7d4ed41..29343a09b 100644 --- a/src/company_cmd.cpp +++ b/src/company_cmd.cpp @@ -78,6 +78,8 @@ void Company::PostDestructor(size_t index) InvalidateWindowData(WC_GRAPH_LEGEND, 0, (int)index); InvalidateWindowData(WC_PERFORMANCE_DETAIL, 0, (int)index); InvalidateWindowData(WC_COMPANY_LEAGUE, 0, 0); + /* If the currently shown error message has this company in it, the close it. */ + InvalidateWindowData(WC_ERRMSG, 0); } /** diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index 42776ca5e..797273af0 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -620,6 +620,12 @@ public: this->DrawWidgets(); } + virtual void OnInvalidateData(int data) + { + /* If company gets shut down, while displaying an error about it, remove the error message. */ + if (this->face != INVALID_COMPANY && !Company::IsValidID(this->face)) delete this; + } + virtual void SetStringParameters(int widget) const { if (widget == EMW_CAPTION) CopyInDParam(0, this->decode_params, lengthof(this->decode_params)); -- cgit v1.2.3-54-g00ecf