summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-04-17 10:52:26 +0000
committerrubidium <rubidium@openttd.org>2010-04-17 10:52:26 +0000
commitb907dfdef840bf0db681b6f996ec912d516efafd (patch)
treeefd31cf06aa0dab0b83206375b6ee44d3cea6a99 /src
parent7a3b6f158879728e051a390696cf716163111e8d (diff)
downloadopenttd-b907dfdef840bf0db681b6f996ec912d516efafd.tar.xz
(svn r19648) -Fix [FS#3760]: a client would not be properly moved when moved while joining, e.g. when entering a company's password. This caused the client to be in the wrong company (according to the rest of the clients) and the client being kicked on the first command
Diffstat (limited to 'src')
-rw-r--r--src/network/network_client.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp
index c2ddbdd39..810fdad95 100644
--- a/src/network/network_client.cpp
+++ b/src/network/network_client.cpp
@@ -453,6 +453,8 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_CLIENT_INFO)
if (MY_CLIENT->HasClientQuit()) return NETWORK_RECV_STATUS_CONN_LOST;
+ if (!Company::IsValidID(playas)) playas = COMPANY_SPECTATOR;
+
ci = NetworkFindClientInfoFromClientID(client_id);
if (ci != NULL) {
if (playas == ci->client_playas && strcmp(name, ci->client_name) != 0) {
@@ -463,6 +465,10 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_CLIENT_INFO)
* Do not display that for now */
}
+ /* Make sure we're in the company the server tells us to be in,
+ * for the rare case that we get moved while joining. */
+ if (client_id == _network_own_client_id) SetLocalCompany(playas);
+
ci->client_playas = playas;
strecpy(ci->client_name, name, lastof(ci->client_name));