From: terencehill Date: Wed, 14 Sep 2016 14:41:02 +0000 (+0200) Subject: Fix division by 0 in another way X-Git-Tag: xonotic-v0.8.2~584 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f5c5e5a349834550c3af2377ca2aa993e7ad8f4c;p=xonotic%2Fxonotic-data.pk3dir.git Fix division by 0 in another way --- 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);