From 666490cfbfe64b07e903a02f0ffd401e0d1e8ea8 Mon Sep 17 00:00:00 2001 From: Walter Julius Hennecke Date: Thu, 20 Feb 2014 23:15:13 +0100 Subject: [PATCH] Manual merge of a loophole fix for the voting system. --- code/game/g_cmds.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/code/game/g_cmds.c b/code/game/g_cmds.c index 263ad65..2fde826 100644 --- a/code/game/g_cmds.c +++ b/code/game/g_cmds.c @@ -984,6 +984,7 @@ static void Cmd_Team_f( gentity_t *ent ) { char send[100]; gentity_t *other; clientSession_t *sess = &ent->client->sess; + qboolean voted = qfalse; //RPG-X: Redtechie - haha to stupid to change teams! if ( g_classData[sess->sessionClass].isn00b ) @@ -1029,8 +1030,16 @@ static void Cmd_Team_f( gentity_t *ent ) { sess->losses++; } + // check and save if this player has already voted + voted = ent->client->ps.eFlags & EF_VOTED; + //if this is a manual change, not an assimilation, uninitialize the clInitStatus data - SetTeam( ent, s ); + SetTeam(ent, s); + + // restore previous vote state if a vote is running + if (voted && level.voteTime) { + ent->client->ps.eFlags |= EF_VOTED; + } ent->client->switchTeamTime = level.time + 2000; }