mirror of https://github.com/OpenTTD/OpenTTD
Codechange: move decision whether to check NewGRFs to SendNewGRFCheck, just like for sending game/company passwords
parent
6eff879e49
commit
26d1d5d6e7
|
@ -401,6 +401,17 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendNewGRFCheck()
|
||||||
{
|
{
|
||||||
Debug(net, 9, "client[{}] SendNewGRFCheck()", this->client_id);
|
Debug(net, 9, "client[{}] SendNewGRFCheck()", this->client_id);
|
||||||
|
|
||||||
|
/* Invalid packet when status is STATUS_NEWGRFS_CHECK or higher */
|
||||||
|
if (this->status >= STATUS_NEWGRFS_CHECK) return this->CloseConnection(NETWORK_RECV_STATUS_MALFORMED_PACKET);
|
||||||
|
|
||||||
|
Debug(net, 9, "client[{}] status = NEWGRFS_CHECK", this->client_id);
|
||||||
|
this->status = STATUS_NEWGRFS_CHECK;
|
||||||
|
|
||||||
|
if (_grfconfig == nullptr) {
|
||||||
|
/* There are no NewGRFs, continue with the game password. */
|
||||||
|
return this->SendNeedGamePassword();
|
||||||
|
}
|
||||||
|
|
||||||
auto p = std::make_unique<Packet>(this, PACKET_SERVER_CHECK_NEWGRFS, TCP_MTU);
|
auto p = std::make_unique<Packet>(this, PACKET_SERVER_CHECK_NEWGRFS, TCP_MTU);
|
||||||
const GRFConfig *c;
|
const GRFConfig *c;
|
||||||
uint grf_count = 0;
|
uint grf_count = 0;
|
||||||
|
@ -922,14 +933,6 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_JOIN(Packet &p)
|
||||||
/* Make sure companies to which people try to join are not autocleaned */
|
/* Make sure companies to which people try to join are not autocleaned */
|
||||||
if (Company::IsValidID(playas)) _network_company_states[playas].months_empty = 0;
|
if (Company::IsValidID(playas)) _network_company_states[playas].months_empty = 0;
|
||||||
|
|
||||||
Debug(net, 9, "client[{}] status = NEWGRFS_CHECK", this->client_id);
|
|
||||||
this->status = STATUS_NEWGRFS_CHECK;
|
|
||||||
|
|
||||||
if (_grfconfig == nullptr) {
|
|
||||||
/* Continue asking for the game password. */
|
|
||||||
return this->SendNeedGamePassword();
|
|
||||||
}
|
|
||||||
|
|
||||||
return this->SendNewGRFCheck();
|
return this->SendNewGRFCheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue