diff options
author | Tim Angus <tim@ngus.net> | 2006-04-24 21:15:23 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2006-04-24 21:15:23 +0000 |
commit | 0d8159469509638abe5cecff2a52ab2ef768be0c (patch) | |
tree | e6e10e8d05f2ab9cde27b13fe9b564b7e4b2e356 | |
parent | 14686f71ad46b7a81c3b747b05dd5a96297ff92c (diff) |
* Limit on number of times votes can be called, defaulting to 5 (from tjw)
-rw-r--r-- | src/game/g_cmds.c | 17 | ||||
-rw-r--r-- | src/game/g_local.h | 3 | ||||
-rw-r--r-- | src/game/g_main.c | 2 |
3 files changed, 16 insertions, 6 deletions
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index f8bbeb86..e881ad4e 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -728,9 +728,12 @@ void Cmd_CallVote_f( gentity_t *ent ) return; } - if( ent->client->pers.voteCount >= MAX_VOTE_COUNT ) + if( g_voteLimit.integer > 0 + && ent->client->pers.voteCount >= g_voteLimit.integer ) { - trap_SendServerCommand( ent-g_entities, "print \"You have called the maximum number of votes\n\"" ); + trap_SendServerCommand( ent-g_entities, va( + "print \"You have already called the maxium number of votes (%d)\n\"", + g_voteLimit.integer ) ); return; } @@ -833,6 +836,8 @@ void Cmd_CallVote_f( gentity_t *ent ) trap_SendServerCommand( -1, va( "print \"%s" S_COLOR_WHITE " called a vote\n\"", ent->client->pers.netname ) ); + ent->client->pers.voteCount++; + // start the voting, the caller autoamtically votes yes level.voteTime = level.time; level.voteYes = 1; @@ -929,9 +934,12 @@ void Cmd_CallTeamVote_f( gentity_t *ent ) return; } - if( ent->client->pers.teamVoteCount >= MAX_VOTE_COUNT ) + if( g_voteLimit.integer > 0 + && ent->client->pers.voteCount >= g_voteLimit.integer ) { - trap_SendServerCommand( ent-g_entities, "print \"You have called the maximum number of team votes\n\"" ); + trap_SendServerCommand( ent-g_entities, va( + "print \"You have already called the maxium number of votes (%d)\n\"", + g_voteLimit.integer ) ); return; } @@ -1042,6 +1050,7 @@ void Cmd_CallTeamVote_f( gentity_t *ent ) "teamclientkick <client>\n\"" ); return; } + ent->client->pers.voteCount++; for( i = 0 ; i < level.maxclients ; i++ ) { diff --git a/src/game/g_local.h b/src/game/g_local.h index 8c9c87f3..a6009908 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -298,7 +298,6 @@ typedef struct } clientSession_t; #define MAX_NETNAME 36 -#define MAX_VOTE_COUNT 3 // data to store details of clients that have abnormally disconnected typedef struct connectionRecord_s @@ -325,7 +324,6 @@ typedef struct int enterTime; // level.time the client entered the game playerTeamState_t teamState; // status in teamplay games int voteCount; // to prevent people from constantly calling votes - int teamVoteCount; // to prevent people from constantly calling votes qboolean teamInfo; // send team overlay updates? pClass_t classSelection; //TA: player class (copied to ent->client->ps.stats[ STAT_PCLASS ] once spawned) @@ -1045,6 +1043,7 @@ extern vmCvar_t g_warmup; extern vmCvar_t g_doWarmup; extern vmCvar_t g_blood; extern vmCvar_t g_allowVote; +extern vmCvar_t g_voteLimit; extern vmCvar_t g_teamAutoJoin; extern vmCvar_t g_teamForceBalance; extern vmCvar_t g_banIPs; diff --git a/src/game/g_main.c b/src/game/g_main.c index 98978b0a..5fca0584 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -75,6 +75,7 @@ vmCvar_t g_blood; vmCvar_t g_podiumDist; vmCvar_t g_podiumDrop; vmCvar_t g_allowVote; +vmCvar_t g_voteLimit; vmCvar_t g_teamAutoJoin; vmCvar_t g_teamForceBalance; vmCvar_t g_banIPs; @@ -172,6 +173,7 @@ static cvarTable_t gameCvarTable[ ] = { &g_podiumDrop, "g_podiumDrop", "70", 0, 0, qfalse }, { &g_allowVote, "g_allowVote", "1", CVAR_ARCHIVE, 0, qfalse }, + { &g_voteLimit, "g_voteLimit", "5", CVAR_ARCHIVE, 0, qfalse }, { &g_listEntity, "g_listEntity", "0", 0, 0, qfalse }, { &g_minCommandPeriod, "g_minCommandPeriod", "500", 0, 0, qfalse}, |