Changeset - r12091:e660aab49861
[Not reviewed]
master
0 1 0
smatz - 15 years ago 2009-06-02 19:56:23
smatz@openttd.org
(svn r16506) -Fix: count only active clients (not those waiting for map download) when checking min_active_clients limit
1 file changed with 10 insertions and 4 deletions:
0 comments (0 inline, 0 general)
src/network/network.cpp
Show inline comments
 
@@ -334,14 +334,20 @@ StringID GetNetworkErrorMsg(NetworkError
 
	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;
0 comments (0 inline, 0 general)