summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2018-11-20 21:01:29 +0100
committerPaweł Redman <pawel.redman@gmail.com>2018-11-20 21:01:29 +0100
commit55b9deeaad19402e3f7618efea325682b2cda7dc (patch)
tree6050735d1762820183c8d11eec87e9f72dcb0f51
parentc0294fce2fc53fa842bee72bec70b81481591d2a (diff)
Avoid indeterminate forms in calculations.antistack
-rw-r--r--src/game/g_main.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/game/g_main.c b/src/game/g_main.c
index 94d664e..dfa45ab 100644
--- a/src/game/g_main.c
+++ b/src/game/g_main.c
@@ -2722,7 +2722,11 @@ static float AntistackScoreBias(int alien_score, int human_score)
if (fabsf(bias) < g_antistackScoreBiasThreshold.value)
return 0.0f;
- return bias * g_antistackScoreBiasFactor.value;
+ bias *= g_antistackScoreBiasFactor.value;;
+ if (isnanf(bias)) // ±inf * 0
+ return 0.0f;
+
+ return bias;
}
static void CheckAntistack(void)