summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorterkhen <terkhen@openttd.org>2011-02-27 11:38:28 +0000
committerterkhen <terkhen@openttd.org>2011-02-27 11:38:28 +0000
commit6e641777b1dec7d0e897ddbb4608281ff43d139c (patch)
treeb2bb52e8f1f5fee9885f2f991523b9f9514b15cf /src/network
parent9ce2823959025cca9d13c68e6ab06b9e0287440c (diff)
downloadopenttd-6e641777b1dec7d0e897ddbb4608281ff43d139c.tar.xz
(svn r22154) -Fix [FS#4529]: _current_company was modified when moving a client to spectators, causing issues in bankruptcy (Rubidium)
Diffstat (limited to 'src/network')
-rw-r--r--src/network/network_client.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp
index 9bf8ec0b4..1bd288a2e 100644
--- a/src/network/network_client.cpp
+++ b/src/network/network_client.cpp
@@ -30,6 +30,7 @@
#include "network.h"
#include "network_base.h"
#include "network_client.h"
+#include "../core/backup_type.hpp"
#include "table/strings.h"
@@ -1155,6 +1156,7 @@ void NetworkClientRequestMove(CompanyID company_id, const char *pass)
void NetworkClientsToSpectators(CompanyID cid)
{
+ Backup<CompanyByte> cur_company(_current_company, FILE_LINE);
/* If our company is changing owner, go to spectators */
if (cid == _local_company) SetLocalCompany(COMPANY_SPECTATOR);
@@ -1164,6 +1166,8 @@ void NetworkClientsToSpectators(CompanyID cid)
NetworkTextMessage(NETWORK_ACTION_COMPANY_SPECTATOR, CC_DEFAULT, false, ci->client_name);
ci->client_playas = COMPANY_SPECTATOR;
}
+
+ cur_company.Restore();
}
void NetworkUpdateClientName()