diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2018-11-20 21:01:29 +0100 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2019-02-10 14:47:47 +0100 |
commit | 8808724c0296da1e59e238e9bf4e759440159b3d (patch) | |
tree | 3076185dc62d6e9d79dcfd023e5ce8b7f9939ea4 /src/game | |
parent | 403b03935cfecf5553375fdf11d4198844fb431b (diff) |
Avoid indeterminate forms in calculations.
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/g_main.c | 6 |
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) |