mirror of https://github.com/OpenTTD/OpenTTD
(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
parent
7a3b6f1588
commit
b907dfdef8
|
@ -453,6 +453,8 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_CLIENT_INFO)
|
||||||
|
|
||||||
if (MY_CLIENT->HasClientQuit()) return NETWORK_RECV_STATUS_CONN_LOST;
|
if (MY_CLIENT->HasClientQuit()) return NETWORK_RECV_STATUS_CONN_LOST;
|
||||||
|
|
||||||
|
if (!Company::IsValidID(playas)) playas = COMPANY_SPECTATOR;
|
||||||
|
|
||||||
ci = NetworkFindClientInfoFromClientID(client_id);
|
ci = NetworkFindClientInfoFromClientID(client_id);
|
||||||
if (ci != NULL) {
|
if (ci != NULL) {
|
||||||
if (playas == ci->client_playas && strcmp(name, ci->client_name) != 0) {
|
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 */
|
* 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;
|
ci->client_playas = playas;
|
||||||
strecpy(ci->client_name, name, lastof(ci->client_name));
|
strecpy(ci->client_name, name, lastof(ci->client_name));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue