mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-24 20:54:08 +01:00
Codechange: strongly type CompanyID
This commit is contained in:
@@ -879,13 +879,13 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_IDENTIFY(Packet
|
||||
if (this->HasClientQuit()) return NETWORK_RECV_STATUS_CLIENT_QUIT;
|
||||
|
||||
/* join another company does not affect these values */
|
||||
switch (playas) {
|
||||
case COMPANY_NEW_COMPANY: // New company
|
||||
switch (playas.base()) {
|
||||
case COMPANY_NEW_COMPANY.base(): // New company
|
||||
if (Company::GetNumItems() >= _settings_client.network.max_companies) {
|
||||
return this->SendError(NETWORK_ERROR_FULL);
|
||||
}
|
||||
break;
|
||||
case COMPANY_SPECTATOR: // Spectator
|
||||
case COMPANY_SPECTATOR.base(): // Spectator
|
||||
break;
|
||||
default: // Join another company (companies 1..MAX_COMPANIES (index 0..(MAX_COMPANIES-1)))
|
||||
if (!Company::IsValidHumanID(playas)) {
|
||||
@@ -918,7 +918,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_IDENTIFY(Packet
|
||||
ci->client_name = client_name;
|
||||
ci->client_playas = playas;
|
||||
ci->public_key = this->peer_public_key;
|
||||
Debug(desync, 1, "client: {:08x}; {:02x}; {:02x}; {:02x}", TimerGameEconomy::date, TimerGameEconomy::date_fract, (int)ci->client_playas, ci->index);
|
||||
Debug(desync, 1, "client: {:08x}; {:02x}; {:02x}; {:02x}", TimerGameEconomy::date, TimerGameEconomy::date_fract, ci->client_playas, ci->index);
|
||||
|
||||
/* Make sure companies to which people try to join are not autocleaned */
|
||||
Company *c = Company::GetIfValid(playas);
|
||||
@@ -1531,7 +1531,7 @@ void NetworkUpdateClientInfo(ClientID client_id)
|
||||
|
||||
if (ci == nullptr) return;
|
||||
|
||||
Debug(desync, 1, "client: {:08x}; {:02x}; {:02x}; {:04x}", TimerGameEconomy::date, TimerGameEconomy::date_fract, (int)ci->client_playas, client_id);
|
||||
Debug(desync, 1, "client: {:08x}; {:02x}; {:02x}; {:04x}", TimerGameEconomy::date, TimerGameEconomy::date_fract, ci->client_playas, client_id);
|
||||
|
||||
for (NetworkClientSocket *cs : NetworkClientSocket::Iterate()) {
|
||||
if (cs->status >= ServerNetworkGameSocketHandler::STATUS_AUTHORIZED) {
|
||||
|
||||
Reference in New Issue
Block a user