Fix new generator on 32 bit arch
authorunc0rr
Wed, 16 Apr 2014 11:18:39 +0400
changeset 10226 cb63617a0c2f
parent 10225 0278759252b6
child 10227 0b848d595f22
Fix new generator on 32 bit arch
hedgewars/uLandGenTemplateBased.pas
--- a/hedgewars/uLandGenTemplateBased.pas	Tue Apr 15 22:36:44 2014 +0400
+++ b/hedgewars/uLandGenTemplateBased.pas	Wed Apr 16 11:18:39 2014 +0400
@@ -98,7 +98,8 @@
 const mapBorderMargin = 40;
     minDistance = 32; // adjust/parametrize this for different details size
 var p1, p2, p4, fp, mp: TPoint;
-    i, t1, t2, a, b, p, q, iy, ix, aqpb: LongInt;
+    i, t1, t2, iy, ix, aqpb: LongInt;
+    a, b, p, q: LongInt;
     dab, d, distL, distR: LongInt;
 begin
     // [p1, p2] is the segment we're trying to divide
@@ -189,7 +190,7 @@
                 if (aqpb <> 0) then
                 begin
                     // (ix; iy) is intersection point
-                    iy:= (((pa.ar[i].x - mp.x) * b + mp.y * a) * q - pa.ar[i].y * p * b) div aqpb;
+                    iy:= ((Int64(pa.ar[i].x - mp.x) * b + Int64(mp.y) * a) * q - Int64(pa.ar[i].y) * p * b) div aqpb;
                     if abs(b) > abs(q) then
                         ix:= (iy - mp.y) * a div b + mp.x
                     else
@@ -220,7 +221,7 @@
                 if (aqpb <> 0) then
                 begin
                     // (ix; iy) is intersection point
-                    iy:= (((p1.x - mp.x) * b + mp.y * a) * q - p1.y * p * b) div aqpb;
+                    iy:= ((Int64(p1.x - mp.x) * b + Int64(mp.y) * a) * q - Int64(p1.y) * p * b) div aqpb;
                     if abs(b) > abs(q) then
                         ix:= (iy - mp.y) * a div b + mp.x
                     else
@@ -239,7 +240,7 @@
                 if (aqpb <> 0) then
                 begin
                     // (ix; iy) is intersection point
-                    iy:= (((p2.x - mp.x) * b + mp.y * a) * q - p2.y * p * b) div aqpb;
+                    iy:= ((Int64(p2.x - mp.x) * b + Int64(mp.y) * a) * q - Int64(p2.y) * p * b) div aqpb;
                     if abs(b) > abs(q) then
                         ix:= (iy - mp.y) * a div b + mp.x
                     else