Fix warnings
authorunC0Rr
Sat, 21 Dec 2013 01:14:59 +0400
changeset 9809 1e32628eb167
parent 9808 37891ba5e10b
child 9810 54c0fdec4600
Fix warnings
hedgewars/uGearsHandlersMess.pas
hedgewars/uGearsHandlersRope.pas
hedgewars/uGearsHedgehog.pas
hedgewars/uGearsList.pas
hedgewars/uGearsRender.pas
hedgewars/uGearsUtils.pas
--- a/hedgewars/uGearsHandlersMess.pas	Fri Dec 20 15:06:18 2013 +0400
+++ b/hedgewars/uGearsHandlersMess.pas	Sat Dec 21 01:14:59 2013 +0400
@@ -292,7 +292,7 @@
       ((TestCollisionXwithGear(Gear, 1) <> 0) or (TestCollisionXwithGear(Gear, -1) <> 0))  then
         begin
         Gear^.X:= tX;
-        Gear^.dX.isNegative:= (gX > leftX+Gear^.Radius*2)
+        Gear^.dX.isNegative:= (gX > LongInt(leftX) + Gear^.Radius*2)
         end;
 
     // clip velocity at 2 - over 1 per pixel, but really shouldn't cause many actual problems.
@@ -758,9 +758,9 @@
         draw:= true;
     xx:= hwRound(Gear^.X);
     yy:= hwRound(Gear^.Y);
-    if draw and (WorldEdge = weWrap) and ((xx < leftX+3) or (xx > rightX-3)) then
-        begin
-        if xx < leftX+3 then 
+    if draw and (WorldEdge = weWrap) and ((xx < LongInt(leftX) + 3) or (xx > LongInt(rightX) - 3)) then
+        begin
+        if xx < LongInt(leftX) + 3 then 
              xx:= rightX-3
         else xx:= leftX+3;
         Gear^.X:= int2hwFloat(xx)
@@ -2230,7 +2230,7 @@
 
                 if Gear^.Health > 0 then
                     dec(Gear^.Health);
-                Gear^.Timer := 450 - Gear^.Tag * 8 + GetRandom(2)
+                Gear^.Timer := 450 - Gear^.Tag * 8 + LongInt(GetRandom(2))
                 end
             else
                 begin
@@ -2244,7 +2244,7 @@
                     end;
 
 // This one is interesting.  I think I understand the purpose, but I wonder if a bit more fuzzy of kicking could be done with getrandom.
-                Gear^.Timer := 100 - Gear^.Tag * 3 + GetRandom(2);
+                Gear^.Timer := 100 - Gear^.Tag * 3 + LongInt(GetRandom(2));
                 if (Gear^.Damage > 3000+Gear^.Tag*1500) then
                     Gear^.Health := 0
                 end
--- a/hedgewars/uGearsHandlersRope.pas	Fri Dec 20 15:06:18 2013 +0400
+++ b/hedgewars/uGearsHandlersRope.pas	Sat Dec 21 01:14:59 2013 +0400
@@ -39,7 +39,7 @@
        ((TestCollisionXwithGear(HHGear, 1) <> 0) or (TestCollisionXwithGear(HHGear, -1) <> 0))  then
         begin
         HHGear^.X:= tX;
-        HHGear^.dX.isNegative:= (hwRound(tX) > leftX+HHGear^.Radius*2)
+        HHGear^.dX.isNegative:= hwRound(tX) > LongInt(leftX) + HHGear^.Radius * 2
         end;
 
     if (HHGear^.Hedgehog^.CurAmmoType = amParachute) and (HHGear^.dY > _0_39) then
@@ -132,7 +132,7 @@
         PlaySound(sndRopeRelease);
         RopeDeleteMe(Gear, HHGear);
         HHGear^.X:= tX;
-        HHGear^.dX.isNegative:= (hwRound(tX) > leftX+HHGear^.Radius*2);
+        HHGear^.dX.isNegative:= hwRound(tX) > LongInt(leftX) + HHGear^.Radius * 2;
         exit
         end;
 
--- a/hedgewars/uGearsHedgehog.pas	Fri Dec 20 15:06:18 2013 +0400
+++ b/hedgewars/uGearsHedgehog.pas	Sat Dec 21 01:14:59 2013 +0400
@@ -1349,7 +1349,7 @@
     if (WorldEdge = weWrap) and ((TestCollisionXwithGear(Gear, 1) <> 0) or (TestCollisionXwithGear(Gear, -1) <> 0))  then
         begin
         Gear^.X:= tX;
-        Gear^.dX.isNegative:= (hwRound(tX) > leftX+Gear^.Radius*2)
+        Gear^.dX.isNegative:= (hwRound(tX) > LongInt(leftX) + Gear^.Radius * 2)
         end
     end;
 
--- a/hedgewars/uGearsList.pas	Fri Dec 20 15:06:18 2013 +0400
+++ b/hedgewars/uGearsList.pas	Sat Dec 21 01:14:59 2013 +0400
@@ -261,9 +261,9 @@
                     if State and gstTmpFlag = 0 then
                         begin
                         dx.isNegative:= GetRandom(2) = 0;
-                        dx.QWordValue:= $40DA * GetRandom(10000) * 8;
+                        dx.QWordValue:= QWord($40DA) * GetRandom(10000) * 8;
                         dy.isNegative:= false;
-                        dy.QWordValue:= $3AD3 * GetRandom(7000) * 8;
+                        dy.QWordValue:= QWord($3AD3) * GetRandom(7000) * 8;
                         if GetRandom(2) = 0 then
                             dx := -dx
                         end;
--- a/hedgewars/uGearsRender.pas	Fri Dec 20 15:06:18 2013 +0400
+++ b/hedgewars/uGearsRender.pas	Sat Dec 21 01:14:59 2013 +0400
@@ -678,7 +678,7 @@
                     DrawSpriteRotated(sprHandConstruction, hx, hy, sign, aangle);
                     if WorldEdge = weWrap then
                         begin
-                        if hwRound(Gear^.X) < leftX+256 then
+                        if hwRound(Gear^.X) < LongInt(leftX) + 256 then
                             DrawSpriteClipped(sprGirder,
                                             rightX+(ox-leftX)-256,
                                             oy-256,
--- a/hedgewars/uGearsUtils.pas	Fri Dec 20 15:06:18 2013 +0400
+++ b/hedgewars/uGearsUtils.pas	Sat Dec 21 01:14:59 2013 +0400
@@ -301,7 +301,7 @@
 
 procedure CheckHHDamage(Gear: PGear);
 var 
-    dmg: Longword;
+    dmg: LongInt;
     i: LongWord;
     particle: PVisualGear;
 begin
@@ -314,7 +314,7 @@
     if dmg < 1 then
         exit;
 
-    for i:= min(12, (3 + dmg div 10)) downto 0 do
+    for i:= min(12, 3 + dmg div 10) downto 0 do
         begin
         particle := AddVisualGear(hwRound(Gear^.X) - 5 + Random(10), hwRound(Gear^.Y) + 12, vgtDust);
         if particle <> nil then
@@ -594,7 +594,7 @@
 tryAgain:= true;
 if WorldEdge <> weNone then 
     begin
-    Left:= max(Left,leftX+Gear^.Radius);
+    Left:= max(Left, LongInt(leftX) + Gear^.Radius);
     Right:= min(Right,rightX-Gear^.Radius)
     end;
 while tryAgain do
@@ -606,7 +606,7 @@
         repeat
             inc(x, Delta);
             cnt:= 0;
-            y:= min(1024, topY) - 2 * Gear^.Radius;
+            y:= min(1024, topY) - Gear^.Radius shl 1;
             while y < cWaterLine do
                 begin
                 repeat
@@ -1220,24 +1220,24 @@
 begin
 WorldWrap:= false;
 if WorldEdge = weNone then exit(false);
-if (hwRound(Gear^.X)-Gear^.Radius < leftX) or
-   (hwRound(Gear^.X)+Gear^.Radius > rightX) then
+if (hwRound(Gear^.X) - Gear^.Radius < LongInt(leftX)) or
+   (hwRound(Gear^.X) + LongInt(Gear^.Radius) > LongInt(rightX)) then
     begin
     if WorldEdge = weWrap then
         begin
-        if (hwRound(Gear^.X)-Gear^.Radius < leftX) then
-             Gear^.X:= int2hwfloat(rightX-Gear^.Radius)
-        else Gear^.X:= int2hwfloat(leftX+Gear^.Radius);
+        if (hwRound(Gear^.X) - Gear^.Radius < LongInt(leftX)) then
+             Gear^.X:= int2hwfloat(rightX - Gear^.Radius)
+        else Gear^.X:= int2hwfloat(LongInt(leftX) + Gear^.Radius);
         LeftImpactTimer:= 150;
         RightImpactTimer:= 150
         end
     else if WorldEdge = weBounce then
         begin
-        if (hwRound(Gear^.X)-Gear^.Radius < leftX) then
+        if (hwRound(Gear^.X) - Gear^.Radius < LongInt(leftX)) then
             begin
             LeftImpactTimer:= 333;
             Gear^.dX.isNegative:= false;
-            Gear^.X:= int2hwfloat(leftX+Gear^.Radius)
+            Gear^.X:= int2hwfloat(LongInt(leftX) + Gear^.Radius)
             end
         else 
             begin