mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-09 15:41:15 +00:00
(svn r16506) -Fix: count only active clients (not those waiting for map download) when checking min_active_clients limit
This commit is contained in:
parent
2fc0cb3e76
commit
2b4d37de3d
@ -334,14 +334,20 @@ StringID GetNetworkErrorMsg(NetworkErrorCode err)
|
||||
return network_error_strings[err];
|
||||
}
|
||||
|
||||
/* Count the number of active clients connected */
|
||||
/**
|
||||
* Counts the number of active clients connected.
|
||||
* It has to be in STATUS_ACTIVE and not a spectator
|
||||
* @return number of active clients
|
||||
*/
|
||||
static uint NetworkCountActiveClients()
|
||||
{
|
||||
const NetworkClientInfo *ci;
|
||||
const NetworkClientSocket *cs;
|
||||
uint count = 0;
|
||||
|
||||
FOR_ALL_CLIENT_INFOS(ci) {
|
||||
if (Company::IsValidID(ci->client_playas)) count++;
|
||||
FOR_ALL_CLIENT_SOCKETS(cs) {
|
||||
if (cs->status != STATUS_ACTIVE) continue;
|
||||
if (!Company::IsValidID(cs->GetInfo()->client_playas)) continue;
|
||||
count++;
|
||||
}
|
||||
|
||||
return count;
|
||||
|
Loading…
Reference in New Issue
Block a user