diff options
author | Christopher Schwarz <lakitu7@gmail.com> | 2010-12-07 15:02:49 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:17:47 +0000 |
commit | fe056327dbcffe8fbe2277a922624c741ce98e99 (patch) | |
tree | 3bbbaf6292756cfaeb7bcf5628bbed7bca12a744 /src/game | |
parent | c3e08ced5274604502c9c476006645f64b5ea516 (diff) |
* (bug 4816) Add team imbalance warning messages
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/g_local.h | 3 | ||||
-rw-r--r-- | src/game/g_main.c | 2 | ||||
-rw-r--r-- | src/game/g_team.c | 27 |
3 files changed, 32 insertions, 0 deletions
diff --git a/src/game/g_local.h b/src/game/g_local.h index 77017acd..81edb7c3 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -656,6 +656,8 @@ typedef struct char layout[ MAX_QPATH ]; team_t surrenderTeam; + int lastTeamImbalancedTime; + int numTeamImbalanceWarnings; voice_t *voices; @@ -1119,6 +1121,7 @@ extern vmCvar_t g_alienCredits; extern vmCvar_t g_alienMaxStage; extern vmCvar_t g_alienStage2Threshold; extern vmCvar_t g_alienStage3Threshold; +extern vmCvar_t g_teamImbalanceWarnings; extern vmCvar_t g_freeFundPeriod; extern vmCvar_t g_unlagged; diff --git a/src/game/g_main.c b/src/game/g_main.c index 797ad6a3..ae9486a3 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -91,6 +91,7 @@ vmCvar_t g_alienCredits; vmCvar_t g_alienMaxStage; vmCvar_t g_alienStage2Threshold; vmCvar_t g_alienStage3Threshold; +vmCvar_t g_teamImbalanceWarnings; vmCvar_t g_freeFundPeriod; vmCvar_t g_unlagged; @@ -215,6 +216,7 @@ static cvarTable_t gameCvarTable[ ] = { &g_alienMaxStage, "g_alienMaxStage", DEFAULT_ALIEN_MAX_STAGE, 0, 0, qfalse }, { &g_alienStage2Threshold, "g_alienStage2Threshold", DEFAULT_ALIEN_STAGE2_THRESH, 0, 0, qfalse }, { &g_alienStage3Threshold, "g_alienStage3Threshold", DEFAULT_ALIEN_STAGE3_THRESH, 0, 0, qfalse }, + { &g_teamImbalanceWarnings, "g_teamImbalanceWarnings", "30", CVAR_ARCHIVE, 0, qfalse }, { &g_freeFundPeriod, "g_freeFundPeriod", DEFAULT_FREEKILL_PERIOD, CVAR_ARCHIVE, 0, qtrue }, { &g_unlagged, "g_unlagged", "1", CVAR_SERVERINFO | CVAR_ARCHIVE, 0, qtrue }, diff --git a/src/game/g_team.c b/src/game/g_team.c index 0852882d..4b0af115 100644 --- a/src/game/g_team.c +++ b/src/game/g_team.c @@ -434,4 +434,31 @@ void CheckTeamStatus( void ) TeamplayInfoMessage( ent ); } } + + // Warn on imbalanced teams + if( g_teamImbalanceWarnings.integer && !level.intermissiontime && + ( level.time - level.lastTeamImbalancedTime > + ( g_teamImbalanceWarnings.integer * 1000 ) ) && + level.numTeamImbalanceWarnings < 3 ) + { + level.lastTeamImbalancedTime = level.time; + if( level.numAlienSpawns > 0 && + level.numHumanClients - level.numAlienClients > 2 ) + { + trap_SendServerCommand( -1, "print \"Teams are imbalanced. " + "Humans have more players.\n\""); + level.numTeamImbalanceWarnings++; + } + else if( level.numHumanSpawns > 0 && + level.numAlienClients - level.numHumanClients > 2 ) + { + trap_SendServerCommand ( -1, "print \"Teams are imbalanced. " + "Aliens have more players.\n\""); + level.numTeamImbalanceWarnings++; + } + else + { + level.numTeamImbalanceWarnings = 0; + } + } } |