From b907dfdef840bf0db681b6f996ec912d516efafd Mon Sep 17 00:00:00 2001 From: rubidium Date: Sat, 17 Apr 2010 10:52:26 +0000 Subject: (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 --- src/network/network_client.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/network/network_client.cpp') 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)); -- cgit v1.2.3-70-g09d2