]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix a division by zero.
authorRudolf Polzer <divverent@xonotic.org>
Thu, 17 Oct 2013 19:50:53 +0000 (21:50 +0200)
committerRudolf Polzer <divverent@xonotic.org>
Thu, 17 Oct 2013 19:52:43 +0000 (21:52 +0200)
qcsrc/server/cl_player.qc

index 1c5daa19f1eb7999d4541a8f586c2de5332e9834..63924e60fe91acd5b0fc08f29ea31cec66c3b022 100644 (file)
@@ -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;
                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);
                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);