fix some pas2c related issues
authorsheepluva
Sat, 29 Nov 2014 01:19:29 +0100
changeset 10560 9f09196d92a6
parent 10556 c4ca0fc00c3b
child 10562 3388822b3914
fix some pas2c related issues
hedgewars/uAmmos.pas
hedgewars/uGearsRender.pas
hedgewars/uIO.pas
hedgewars/uLandObjects.pas
hedgewars/uLandOutline.pas
hedgewars/uScript.pas
hedgewars/uUtils.pas
--- a/hedgewars/uAmmos.pas	Fri Nov 28 14:58:33 2014 -0500
+++ b/hedgewars/uAmmos.pas	Sat Nov 29 01:19:29 2014 +0100
@@ -43,11 +43,11 @@
 procedure SetWeapon(weap: TAmmoType);
 procedure DisableSomeWeapons;
 procedure ResetWeapons;
-function  GetAmmoByNum(num: Longword): PHHAmmo;
+function  GetAmmoByNum(num: LongInt): PHHAmmo;
 function  GetCurAmmoEntry(var Hedgehog: THedgehog): PAmmo;
 function  GetAmmoEntry(var Hedgehog: THedgehog; am: TAmmoType): PAmmo;
 
-var StoreCnt: Longword;
+var StoreCnt: LongInt;
 
 implementation
 uses uVariables, uCommands, uUtils, uCaptions, uDebug;
@@ -151,7 +151,7 @@
 FillAmmoStore(StoresList[Pred(StoreCnt)], newAmmos)
 end;
 
-function GetAmmoByNum(num: Longword): PHHAmmo;
+function GetAmmoByNum(num: LongInt): PHHAmmo;
 begin
     TryDo(num < StoreCnt, 'Invalid store number', true);
     GetAmmoByNum:= StoresList[num]
--- a/hedgewars/uGearsRender.pas	Fri Nov 28 14:58:33 2014 -0500
+++ b/hedgewars/uGearsRender.pas	Sat Nov 29 01:19:29 2014 +0100
@@ -624,7 +624,7 @@
 
         if ((Gear^.State and gstAnimation) <> 0) then
             begin
-            if (TWave(Gear^.Tag) < Low(TWave)) or (TWave(Gear^.Tag) > High(TWave)) then
+            if (Gear^.Tag < LongInt(ord(Low(TWave)))) or (Gear^.Tag > LongInt(ord(High(TWave)))) then
                 begin
                 Gear^.State:= Gear^.State and (not gstAnimation);
                 end
--- a/hedgewars/uIO.pas	Fri Nov 28 14:58:33 2014 -0500
+++ b/hedgewars/uIO.pas	Sat Nov 29 01:19:29 2014 +0100
@@ -350,7 +350,7 @@
 
 while (headcmd <> nil)
     and (tmpflag or (headcmd^.cmd = '#')) // '#' is the only cmd which can be sent within same tick after 'N'
-    and ((GameTicks = hiTicks shl 16 + headcmd^.loTime)
+    and ((GameTicks = LongWord(hiTicks shl 16 + headcmd^.loTime))
         or (headcmd^.cmd = 's') // for these commands time is not specified
         or (headcmd^.cmd = 'h') // seems the hedgewars protocol does not allow remote synced commands
         or (headcmd^.cmd = '#') // must be synced for saves to work
--- a/hedgewars/uLandObjects.pas	Fri Nov 28 14:58:33 2014 -0500
+++ b/hedgewars/uLandObjects.pas	Sat Nov 29 01:19:29 2014 +0100
@@ -253,15 +253,15 @@
     inc(x1, 2);
     if k = 16 then
         begin
-        while (x2 < (rightX-150)) and (CountNonZeroz(x2, y) = 0) do
+        while (x2 < (LongInt(rightX)-150)) and (CountNonZeroz(x2, y) = 0) do
             inc(x2, 2);
         i:= x2 + 12;
         repeat
         inc(x2, 2);
         k:= CountNonZeroz(x2, y)
-        until (x2 >= (rightX-150)) or (k = 0) or (k = 16) or (x2 > i) or (x2 - x1 >= 768);
+        until (x2 >= (LongInt(rightX)-150)) or (k = 0) or (k = 16) or (x2 > i) or (x2 - x1 >= 768);
 
-        if (x2 < (rightX - 150)) and (k = 16) and (x2 - x1 > 250) and (x2 - x1 < 768)
+        if (x2 < (LongInt(rightX) - 150)) and (k = 16) and (x2 - x1 > 250) and (x2 - x1 < 768)
         and (not CheckIntersect(x1 - 32, y - 64, x2 - x1 + 64, 144)) then
                 break;
         end;
--- a/hedgewars/uLandOutline.pas	Fri Nov 28 14:58:33 2014 -0500
+++ b/hedgewars/uLandOutline.pas	Sat Nov 29 01:19:29 2014 +0100
@@ -253,7 +253,7 @@
 var i: Longword;
 begin
     CheckSelfIntersect:= false;
-    if (ind <= 0) or (ind >= Pred(pa.Count)) then
+    if (ind <= 0) or (LongInt(ind) >= Pred(pa.Count)) then
         exit;
 
     CheckSelfIntersect:= true;
--- a/hedgewars/uScript.pas	Fri Nov 28 14:58:33 2014 -0500
+++ b/hedgewars/uScript.pas	Sat Nov 29 01:19:29 2014 +0100
@@ -2534,7 +2534,7 @@
 function ScriptCall(fname : shortstring; par1, par2, par3, par4 : LongInt) : LongInt;
 begin
 if (not ScriptLoaded) or (not ScriptExists(fname)) then
-    exit;
+    exit(0);
 SetGlobals;
 lua_getglobal(luaState, Str2PChar(fname));
 lua_pushinteger(luaState, par1);
--- a/hedgewars/uUtils.pas	Fri Nov 28 14:58:33 2014 -0500
+++ b/hedgewars/uUtils.pas	Sat Nov 29 01:19:29 2014 +0100
@@ -280,7 +280,7 @@
 
 function DecodeBase64(s: shortstring): shortstring;
 const table = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
-var i, t, c: Longword;
+var i, t, c: LongInt;
 begin
 c:= 0;
 for i:= 1 to Length(s) do