mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-22 05:59:10 +00:00
(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
This commit is contained in:
@@ -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));
|
||||
|
||||
|
Reference in New Issue
Block a user