Mercurial > hg > openttd
changeset 12096:f8d1c7749ab0 draft
(svn r16506) -Fix: count only active clients (not those waiting for map download) when checking min_active_clients limit
author | smatz <smatz@openttd.org> |
---|---|
date | Tue, 02 Jun 2009 19:56:23 +0000 |
parents | 330c67eebb69 |
children | 6df400d87245 |
files | src/network/network.cpp |
diffstat | 1 files changed, 10 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/network/network.cpp +++ b/src/network/network.cpp @@ -334,14 +334,20 @@ 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;