From: Rudolf Polzer Date: Thu, 17 Oct 2013 19:50:53 +0000 (+0200) Subject: Fix a division by zero. X-Git-Tag: xonotic-v0.8.0~279 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b0e190996cd575ce487f9297d0207f1b0355ecbf;p=xonotic%2Fxonotic-data.pk3dir.git Fix a division by zero. --- diff --git a/qcsrc/server/cl_player.qc b/qcsrc/server/cl_player.qc index 1c5daa19f..63924e60f 100644 --- a/qcsrc/server/cl_player.qc +++ b/qcsrc/server/cl_player.qc @@ -353,7 +353,10 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht ear1 += v_right * -10; ear2 += v_right * +10; d = inflictor.origin - self.origin; - f = (d * v_right) / vlen(d); // this is cos of angle of d and v_right! + if (d) + f = (d * v_right) / vlen(d); // this is cos of angle of d and v_right! + else + f = 0; // Assum ecenter. force = v_right * vlen(force); Violence_GibSplash_At(ear1, force * -1, 2, bound(0, damage, 25) / 2 * (0.5 - 0.5 * f), self, attacker); Violence_GibSplash_At(ear2, force, 2, bound(0, damage, 25) / 2 * (0.5 + 0.5 * f), self, attacker);