summaryrefslogtreecommitdiff
path: root/src/game/g_client.c
diff options
context:
space:
mode:
authorIronClawTrem <louie.nutman@gmail.com>2020-04-28 21:13:54 +0100
committerIronClawTrem <louie.nutman@gmail.com>2020-04-28 21:13:54 +0100
commit1c6463253885c31ab09c4f1bfeb537646505f273 (patch)
tree31d4f42cf775f92b81ae76b38937af13634bc906 /src/game/g_client.c
parente346c3070ecbdb425b50930b10a1b05cbf4b607f (diff)
Discard players' votes when they leave.
Diffstat (limited to 'src/game/g_client.c')
-rw-r--r--src/game/g_client.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/game/g_client.c b/src/game/g_client.c
index 871bacb..f4b1611 100644
--- a/src/game/g_client.c
+++ b/src/game/g_client.c
@@ -1825,7 +1825,7 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles
client->pers.teamState.state = TEAM_ACTIVE;
// toggle the teleport bit so the client knows to not lerp
- flags = ent->client->ps.eFlags & ( EF_TELEPORT_BIT | EF_VOTED | EF_TEAMVOTED );
+ flags = ent->client->ps.eFlags & EF_TELEPORT_BIT;
flags ^= EF_TELEPORT_BIT;
G_UnlaggedClear( ent );
@@ -2090,6 +2090,23 @@ void ClientDisconnect( int clientNum )
if( !ent->client )
return;
+ // discard this player's vote
+ if( level.voteTime && level.votedHow[ clientNum ] )
+ {
+ if( level.votedHow[ clientNum ] > 0 )
+ {
+ level.voteYes--;
+ trap_SetConfigstring( CS_VOTE_YES, va( "%i", level.voteYes ) );
+ }
+ else
+ {
+ level.voteNo--;
+ trap_SetConfigstring( CS_VOTE_NO, va( "%i", level.voteNo ) );
+ }
+
+ level.votedHow[ clientNum ] = 0;
+ }
+
// look through the bhist and readjust it if the referenced ent has left
for( ptr = level.buildHistory; ptr; ptr = ptr->next )
{