summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Martin Hansen <nielsm@indvikleren.dk>2019-09-08 10:26:09 +0200
committerCharles Pigott <charlespigott@googlemail.com>2019-09-14 19:16:39 +0100
commitd35254139ab6a829e523e76ae902ef8b9ba610f3 (patch)
tree3aa779c7fb138db5076e149db0997646a8bf24c5
parent1978b9122bad2cde548846e3e4daadbe517db7a3 (diff)
downloadopenttd-d35254139ab6a829e523e76ae902ef8b9ba610f3.tar.xz
Fix #7479: Don't close construction windows when changing client name
-rw-r--r--src/company_cmd.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/company_cmd.cpp b/src/company_cmd.cpp
index af7913e2c..f4eb7fb3e 100644
--- a/src/company_cmd.cpp
+++ b/src/company_cmd.cpp
@@ -104,15 +104,18 @@ void SetLocalCompany(CompanyID new_company)
/* company could also be COMPANY_SPECTATOR or OWNER_NONE */
assert(Company::IsValidID(new_company) || new_company == COMPANY_SPECTATOR || new_company == OWNER_NONE);
+ /* If actually changing to another company, several windows need closing */
+ bool switching_company = _local_company != new_company;
+
/* Delete the chat window, if you were team chatting. */
- InvalidateWindowData(WC_SEND_NETWORK_MSG, DESTTYPE_TEAM, _local_company);
+ if (switching_company) InvalidateWindowData(WC_SEND_NETWORK_MSG, DESTTYPE_TEAM, _local_company);
assert(IsLocalCompany());
_current_company = _local_company = new_company;
/* Delete any construction windows... */
- DeleteConstructionWindows();
+ if (switching_company) DeleteConstructionWindows();
/* ... and redraw the whole screen. */
MarkWholeScreenDirty();