From b8af61d3f69c248d00c666d142b7c86faa46f43c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Fri, 20 Dec 2024 12:25:26 +0100 Subject: [PATCH] Avoid string-based address comparison for `sv_vote_kick_min` Compare client addresses directly to determine the distinct client count excluding spectators. This is consistent with the `IServer::DistinctClientCount` function though this does not check for spectators. --- src/game/server/gamecontext.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp index 6f78d4e038c..57acc45a4b4 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -2326,12 +2326,12 @@ void CGameContext::OnCallVoteNetMessage(const CNetMsg_Cl_CallVote *pMsg, int Cli if(g_Config.m_SvVoteKickMin && !GetDDRaceTeam(ClientId)) { - char aaAddresses[MAX_CLIENTS][NETADDR_MAXSTRSIZE] = {{0}}; + NETADDR aAddresses[MAX_CLIENTS]; for(int i = 0; i < MAX_CLIENTS; i++) { if(m_apPlayers[i]) { - Server()->GetClientAddr(i, aaAddresses[i], NETADDR_MAXSTRSIZE); + Server()->GetClientAddr(i, &aAddresses[i]); } } int NumPlayers = 0; @@ -2344,7 +2344,7 @@ void CGameContext::OnCallVoteNetMessage(const CNetMsg_Cl_CallVote *pMsg, int Cli { if(m_apPlayers[j] && m_apPlayers[j]->GetTeam() != TEAM_SPECTATORS && !GetDDRaceTeam(j)) { - if(str_comp(aaAddresses[i], aaAddresses[j]) == 0) + if(!net_addr_comp_noport(&aAddresses[i], &aAddresses[j])) { NumPlayers--; break;