diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp index 439bd8f31..924254d77 100644 --- a/src/engine/server/server.cpp +++ b/src/engine/server/server.cpp @@ -1855,6 +1855,9 @@ void CServer::CacheServerInfo(CCache *pCache, int Type, bool SendClients) ADD_INT(p, g_Config.m_Password[0] ? SERVER_FLAG_PASSWORD : 0); int MaxClients = m_NetServer.MaxClients(); + // How many clients the used serverinfo protocol supports, has to be tracked + // separately to make sure we don't subtract the reserved slots from it + int MaxClientsProtocol = MAX_CLIENTS; if(Type == SERVERINFO_VANILLA || Type == SERVERINFO_INGAME) { if(ClientCount >= VANILLA_MAX_CLIENTS) @@ -1864,16 +1867,15 @@ void CServer::CacheServerInfo(CCache *pCache, int Type, bool SendClients) else ClientCount = VANILLA_MAX_CLIENTS; } - if(MaxClients > VANILLA_MAX_CLIENTS) - MaxClients = VANILLA_MAX_CLIENTS; + MaxClientsProtocol = VANILLA_MAX_CLIENTS; if(PlayerCount > ClientCount) PlayerCount = ClientCount; } ADD_INT(p, PlayerCount); // num players - ADD_INT(p, maximum(MaxClients - maximum(g_Config.m_SvSpectatorSlots, g_Config.m_SvReservedSlots), PlayerCount)); // max players + ADD_INT(p, minimum(MaxClientsProtocol, maximum(MaxClients - maximum(g_Config.m_SvSpectatorSlots, g_Config.m_SvReservedSlots), PlayerCount))); // max players ADD_INT(p, ClientCount); // num clients - ADD_INT(p, maximum(MaxClients - g_Config.m_SvReservedSlots, ClientCount)); // max clients + ADD_INT(p, minimum(MaxClientsProtocol, maximum(MaxClients - g_Config.m_SvReservedSlots, ClientCount))); // max clients if(Type == SERVERINFO_EXTENDED) p.AddString("", 0); // extra info, reserved