summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikko Tiusanen <ams@daug.net>2014-07-06 16:12:58 +0300
committerMikko Tiusanen <ams@daug.net>2014-07-06 16:12:58 +0300
commit546b7743d10bcd75998569dfc8c1818804f76213 (patch)
treeda7cc4e1afd49a65ff1efe41b77ab84b9320f220
parenta7af4c67c3e5e4b02fa89aaa2443f83c66d06cfb (diff)
Extra players now kept in spawn queue instead of auto-balance if g_teamForceBalance is set to 2.
Automatic team balancing now honors locked teams and g_teamForceBalance setting.
-rw-r--r--src/game/g_main.c14
-rw-r--r--src/game/g_team.c14
2 files changed, 24 insertions, 4 deletions
diff --git a/src/game/g_main.c b/src/game/g_main.c
index 977ab1e..11376ac 100644
--- a/src/game/g_main.c
+++ b/src/game/g_main.c
@@ -1049,11 +1049,25 @@ void G_SpawnClients( team_t team )
{
sq = &level.alienSpawnQueue;
numSpawns = level.numAlienSpawns;
+ if( g_teamForceBalance.integer == 2 &&
+ !level.humanTeamLocked &&
+ !level.alienTeamLocked &&
+ level.numAlienClients-level.numHumanClients > 1 )
+ {
+ return;
+ }
}
else if( team == TEAM_HUMANS )
{
sq = &level.humanSpawnQueue;
numSpawns = level.numHumanSpawns;
+ if( g_teamForceBalance.integer == 2 &&
+ !level.humanTeamLocked &&
+ !level.alienTeamLocked &&
+ level.numHumanClients-level.numAlienClients > 1 )
+ {
+ return;
+ }
}
if( G_GetSpawnQueueLength( sq ) > 0 && numSpawns > 0 )
diff --git a/src/game/g_team.c b/src/game/g_team.c
index debe11f..fb3332b 100644
--- a/src/game/g_team.c
+++ b/src/game/g_team.c
@@ -279,9 +279,9 @@ void G_ChangeTeam( gentity_t *ent, team_t newTeam )
}
- /*
+/*
Call this method to balance teams
- */
+*/
void G_BalanceTeams()
{
team_t sourceTeam;
@@ -540,7 +540,10 @@ void CheckTeamStatus( void )
trap_SendServerCommand( -1, "print \"^5Teams are imbalanced. "
"^5Humans have more players.\n\"");
level.numTeamImbalanceWarnings++;
- G_BalanceTeams();
+ if ( !level.humanTeamLocked &&
+ !level.alienTeamLocked &&
+ g_teamForceBalance.integer == 1)
+ G_BalanceTeams();
}
else if( level.numHumanSpawns > 0 && level.numHumanArmouries > 0 &&
level.numAlienClients - level.numHumanClients >= 2 )
@@ -548,7 +551,10 @@ void CheckTeamStatus( void )
trap_SendServerCommand ( -1, "print \"^5Teams are imbalanced. "
"^5Aliens have more players.\n\"");
level.numTeamImbalanceWarnings++;
- G_BalanceTeams();
+ if ( !level.humanTeamLocked &&
+ !level.alienTeamLocked &&
+ g_teamForceBalance.integer == 1)
+ G_BalanceTeams();
}
else
{