From: Mario Date: Sun, 28 Feb 2016 22:49:08 +0000 (+1000) Subject: Recount votes when a player leaves, also don't count votes from connecting clients X-Git-Tag: xonotic-v0.8.2~1168 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ceb2e95db8d8a5d2fb4f80e3b1d9436a9b5e5a02;p=xonotic%2Fxonotic-data.pk3dir.git Recount votes when a player leaves, also don't count votes from connecting clients --- 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