summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2018-11-17 13:33:28 +0100
committerPaweł Redman <pawel.redman@gmail.com>2018-11-17 13:33:28 +0100
commit2e45a9465849af6bb0a56c33a9723e7d98d806ad (patch)
tree0e05531e40a87e3cf519defebf2a50065f5f40b3
parent63e3605d1d05d01fe1ecc6b8f556a152ddc0cad0 (diff)
Fix handicap not always resetting as expected.
-rw-r--r--src/game/g_main.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/game/g_main.c b/src/game/g_main.c
index e1eb7c3..89f1f3a 100644
--- a/src/game/g_main.c
+++ b/src/game/g_main.c
@@ -2723,14 +2723,15 @@ static void CheckAntistack(void)
const char *log_notice = "";
float teambias = 0.0f, scorebias = 0.0f, bias, handicap = 0.0f;
- if (!g_antistack.integer || level.intermissiontime)
+ if (!g_antistack.integer || level.intermissiontime) {
+ level.alienHandicap = 1.0f;
+ level.humanHandicap = 1.0f;
return;
+ }
if (level.time < level.antistackNextCheck)
return;
- level.antistackWasHandicapping = qfalse;
-
for (int i = 0; i < level.maxclients; i++) {
gclient_t *client = level.clients + i;
int score;
@@ -2757,20 +2758,21 @@ static void CheckAntistack(void)
if (aliens + humans < g_antistackPlayerThreshold.integer) {
log_notice = " (too few players)";
bias = 0.0f;
- goto out;
+ goto skip_bias;
}
if (alien_score < g_antistackScoreThreshold.integer &&
human_score < g_antistackScoreThreshold.integer) {
log_notice = " (too little score)";
bias = 0.0f;
- goto out;
+ goto skip_bias;
}
teambias = AntistackTeamBias(aliens, humans);
scorebias = AntistackScoreBias(alien_score, human_score);
bias = teambias + scorebias;
+skip_bias:
if (fabs(bias) < g_antistackBiasThreshold.value) {
log_notice = " (too little bias)";
bias = 0.0f;
@@ -2784,7 +2786,8 @@ static void CheckAntistack(void)
level.alienHandicap = 1.0f;
level.humanHandicap = 1.0f;
- goto out;
+ level.antistackWasHandicapping = qfalse;
+ goto skip_handicap;
}
level.antistackWasHandicapping = qtrue;
@@ -2816,7 +2819,7 @@ static void CheckAntistack(void)
level.humanHandicap = 1.0f;
}
-out:
+skip_handicap:
G_LogPrintf("Antistack: %dv%d %d:%d %f %f %f %i %f%s\n",
aliens, humans, alien_score, human_score, teambias,
scorebias, bias, handicap_team, handicap, log_notice);