]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix #2365 "Div by zero at hydroxon startup"
authorterencehill <piuntn@gmail.com>
Sat, 21 Dec 2019 23:39:52 +0000 (00:39 +0100)
committerterencehill <piuntn@gmail.com>
Sat, 21 Dec 2019 23:39:52 +0000 (00:39 +0100)
qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc

index 03b2ec9d1d428a3c7dfce3b0d3cbcb2d5fe05bd1..8ce4d6f31f15f9e1123bde9b959f8df02d1635a3 100644 (file)
@@ -1387,7 +1387,7 @@ void havocbot_ctf_calculate_middlepoint()
                // for symmetrical editing of waypoints
                entity f1 = ctf_worldflaglist;
                entity f2 = f1.ctf_worldflagnext;
-               float m = -(f1.origin.y - f2.origin.y) / (f1.origin.x - f2.origin.x);
+               float m = -(f1.origin.y - f2.origin.y) / (max(f1.origin.x - f2.origin.x, FLOAT_EPSILON));
                float q = havocbot_middlepoint.y - m * havocbot_middlepoint.x;
                havocbot_symmetry_axis_m = m;
                havocbot_symmetry_axis_q = q;