From f5c5e5a349834550c3af2377ca2aa993e7ad8f4c Mon Sep 17 00:00:00 2001 From: terencehill Date: Wed, 14 Sep 2016 16:41:02 +0200 Subject: [PATCH] Fix division by 0 in another way --- qcsrc/common/stats.qh | 2 +- qcsrc/server/weapons/weaponsystem.qc | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/qcsrc/common/stats.qh b/qcsrc/common/stats.qh index 15de05827..d6aa068ea 100644 --- a/qcsrc/common/stats.qh +++ b/qcsrc/common/stats.qh @@ -64,7 +64,7 @@ REGISTER_STAT(WEAPON_NEXTTHINK, float) SPECTATE_COPYFIELD(_STAT(WEAPON_NEXTTHINK)) float W_WeaponRateFactor(entity this); #endif -REGISTER_STAT(WEAPONRATEFACTOR, float) +REGISTER_STAT(WEAPONRATEFACTOR, float, W_WeaponRateFactor(this)) REGISTER_STAT(GAMESTARTTIME, float) REGISTER_STAT(STRENGTH_FINISHED, float) diff --git a/qcsrc/server/weapons/weaponsystem.qc b/qcsrc/server/weapons/weaponsystem.qc index 451c50ec1..4968d3c31 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -21,7 +21,9 @@ float W_WeaponRateFactor(entity this) { - float t = 1.0 / g_weaponratefactor; + float t = 1; + if(g_weaponratefactor > 0) + t = 1.0 / g_weaponratefactor; MUTATOR_CALLHOOK(WeaponRateFactor, t, this); t = M_ARGV(0, float); -- 2.39.2