From ceb2e95db8d8a5d2fb4f80e3b1d9436a9b5e5a02 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 29 Feb 2016 08:49:08 +1000 Subject: [PATCH] Recount votes when a player leaves, also don't count votes from connecting clients --- qcsrc/server/cl_client.qc | 1 + qcsrc/server/command/vote.qc | 2 +- qcsrc/server/command/vote.qh | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 5328e959f..e683a4e24 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -1244,6 +1244,7 @@ void ClientDisconnect () self.playerid = 0; ReadyCount(); + VoteCount(false); // free cvars GetCvars(-1); diff --git a/qcsrc/server/command/vote.qc b/qcsrc/server/command/vote.qc index 76f08bdc9..223bbeb09 100644 --- a/qcsrc/server/command/vote.qc +++ b/qcsrc/server/command/vote.qc @@ -215,7 +215,7 @@ void VoteCount(float first_count) Nagger_VoteCountChanged(); // add up all the votes from each connected client - FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA( + FOREACH_CLIENT(IS_REAL_CLIENT(it) && IS_CLIENT(it), LAMBDA( ++vote_player_count; if (IS_PLAYER(it)) ++vote_real_player_count; switch (it.vote_selection) diff --git a/qcsrc/server/command/vote.qh b/qcsrc/server/command/vote.qh index 98b000e75..0cab6c1d4 100644 --- a/qcsrc/server/command/vote.qh +++ b/qcsrc/server/command/vote.qh @@ -54,4 +54,5 @@ float restart_mapalreadyrestarted; // bool, indicates whether reset_map() was al void reset_map(float dorespawn); void ReadyCount(); void ReadyRestart_force(); +void VoteCount(float first_count); #endif -- 2.39.2