REmove stupid int64 conversions, provide real fixes to compiler hints
authorunc0rr
Sun, 07 Nov 2010 16:41:03 +0300
changeset 4159 64e677349124
parent 4158 08f4627ad2b3
child 4160 043c17a8b3ca
REmove stupid int64 conversions, provide real fixes to compiler hints
hedgewars/uGears.pas
hedgewars/uLandObjects.pas
hedgewars/uVisualGears.pas
hedgewars/uWorld.pas
--- a/hedgewars/uGears.pas	Sun Nov 07 16:33:42 2010 +0300
+++ b/hedgewars/uGears.pas	Sun Nov 07 16:41:03 2010 +0300
@@ -1060,8 +1060,8 @@
     begin
     if not (((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) and ((Gear^.State and gstAttacked) = 0)) then
         exit;
-    DrawTexture(round(int64(sx) + 16), round(int64(sy) + 16), ropeIconTex);
-    DrawTextureF(SpritesData[sprAMAmmos].Texture, 0.75, round(int64(sx) + 30), round(int64(sy) + 30), ord(CurAmmoType) - 1, 1, 32, 32);
+    DrawTexture(sx + 16, sy + 16, ropeIconTex);
+    DrawTextureF(SpritesData[sprAMAmmos].Texture, 0.75, sx + 30, sy + 30, ord(CurAmmoType) - 1, 1, 32, 32);
     end;
 end;
 
--- a/hedgewars/uLandObjects.pas	Sun Nov 07 16:33:42 2010 +0300
+++ b/hedgewars/uLandObjects.pas	Sun Nov 07 16:41:03 2010 +0300
@@ -292,9 +292,9 @@
                    end
                 end;
              inc(y, 3);
-         until y > int64(LAND_HEIGHT) - 1 - Height;
+         until y >= LAND_HEIGHT - Height;
          inc(x, getrandom(6) + 3)
-     until x > int64(LAND_WIDTH) - 1 - Width;
+     until x >= LAND_WIDTH - Width;
      bRes:= cnt <> 0;
      if bRes then
         begin
@@ -341,9 +341,9 @@
                 end
             end;
             inc(y, 12);
-        until y > int64(LAND_HEIGHT) - 1 - Height - 8;
+        until y >= LAND_HEIGHT - Height - 8;
         inc(x, getrandom(12) + 12)
-    until x > int64(LAND_WIDTH) - 1 - Width;
+    until x >= LAND_WIDTH - Width;
     bRes:= cnt <> 0;
     if bRes then
         begin
--- a/hedgewars/uVisualGears.pas	Sun Nov 07 16:33:42 2010 +0300
+++ b/hedgewars/uVisualGears.pas	Sun Nov 07 16:41:03 2010 +0300
@@ -369,7 +369,7 @@
       if Gear^.Kind = vgtFlake then
           begin
           // Damage calc from doMakeExplosion
-          dmg:= min(101, int64(Radius) + cHHRadius div 2 - (round(abs(Gear^.X - float(X))+abs(Gear^.Y - float(Y))) div 5));
+          dmg:= min(101, Radius + cHHRadius div 2 - LongInt(abs(round(Gear^.X) - X) + abs(round(Gear^.Y) - Y)) div 5);
           if dmg > 1 then
               begin
               Gear^.tdX:= 0.02 * dmg + 0.01;
--- a/hedgewars/uWorld.pas	Sun Nov 07 16:33:42 2010 +0300
+++ b/hedgewars/uWorld.pas	Sun Nov 07 16:41:03 2010 +0300
@@ -620,8 +620,8 @@
                 tdy:= - Cos(Gear^.Angle * Pi / cMaxAngle);
                 for i:= (Gear^.Power * 24) div cPowerDivisor downto 0 do
                     DrawSprite(sprPower,
-                            int64(hwRound(Gear^.X)) + GetLaunchX(CurAmmoType, hwSign(Gear^.dX), Gear^.Angle) + round(WorldDx + tdx * (24 + i * 2)) - 16,
-                            int64(hwRound(Gear^.Y)) + GetLaunchY(CurAmmoType, Gear^.Angle) + round(WorldDy + tdy * (24 + i * 2)) - 16,
+                            hwRound(Gear^.X) + GetLaunchX(CurAmmoType, hwSign(Gear^.dX), Gear^.Angle) + LongInt(round(WorldDx + tdx * (24 + i * 2))) - 16,
+                            hwRound(Gear^.Y) + GetLaunchY(CurAmmoType, Gear^.Angle) + LongInt(round(WorldDy + tdy * (24 + i * 2))) - 16,
                             i)
                 end
         end;