Implicit type casts to help pas2c
authorunc0rr
Sat, 08 Feb 2014 16:29:34 +0400
changeset 10123 64e72781d344
parent 10122 cefede760264
child 10124 aabd1b75d5a3
Implicit type casts to help pas2c
hedgewars/uAmmos.pas
hedgewars/uGearsHandlersMess.pas
hedgewars/uGearsHedgehog.pas
hedgewars/uLocale.pas
hedgewars/uPhysFSLayer.pas
hedgewars/uStore.pas
--- a/hedgewars/uAmmos.pas	Fri Feb 07 23:57:32 2014 +0400
+++ b/hedgewars/uAmmos.pas	Sat Feb 08 16:29:34 2014 +0400
@@ -371,7 +371,7 @@
 end;
 
 procedure ApplyAmmoChanges(var Hedgehog: THedgehog);
-var s: shortstring;
+var s: ansistring;
     CurWeapon: PAmmo;
 begin
 TargetPoint.X:= NoPointX;
@@ -395,9 +395,9 @@
         begin
         s:= trammo[Ammoz[AmmoType].NameId];
         if (Count <> AMMO_INFINITE) and (not (Hedgehog.Team^.ExtDriven or (Hedgehog.BotLevel > 0))) then
-            s:= s + ' (' + IntToStr(Count) + ')';
+            s:= s + ansistring(' (' + IntToStr(Count) + ')');
         if (Propz and ammoprop_Timerable) <> 0 then
-            s:= s + ', ' + IntToStr(Timer div 1000) + ' ' + trammo[sidSeconds];
+            s:= s + ansistring(', ' + IntToStr(Timer div 1000) + ' ') + trammo[sidSeconds];
         AddCaption(s, Team^.Clan^.Color, capgrpAmmoinfo);
         if (Propz and ammoprop_NeedTarget) <> 0 then
             begin
--- a/hedgewars/uGearsHandlersMess.pas	Fri Feb 07 23:57:32 2014 +0400
+++ b/hedgewars/uGearsHandlersMess.pas	Sat Feb 08 16:29:34 2014 +0400
@@ -3548,7 +3548,7 @@
         Gear^.Damage:= i;
         //AddCaption('Fuel: '+inttostr(round(Gear^.Health/20))+'%', cWhiteColor, capgrpAmmostate);
         FreeTexture(Gear^.Tex);
-        Gear^.Tex := RenderStringTex(trmsg[sidFuel] + ': ' + inttostr(i) + '%', cWhiteColor, fntSmall)
+        Gear^.Tex := RenderStringTex(trmsg[sidFuel] + ansistring(': ' + inttostr(i) + '%'), cWhiteColor, fntSmall)
         end;
 
     if (HHGear^.Message and (gmAttack or gmUp or gmLeft or gmRight) <> 0) and
@@ -4705,8 +4705,8 @@
             begin
             Gear^.Damage:= i;
             FreeTexture(Gear^.Tex);
-            Gear^.Tex := RenderStringTex(trmsg[sidFuel] + ': ' + inttostr(i) +
-                         '%', cWhiteColor, fntSmall)
+            Gear^.Tex := RenderStringTex(trmsg[sidFuel] + ansistring(': ' + inttostr(i) +
+                         '%'), cWhiteColor, fntSmall)
             end
         end
 end;
@@ -4782,8 +4782,8 @@
             begin
             Gear^.Damage:= i;
             FreeTexture(Gear^.Tex);
-            Gear^.Tex := RenderStringTex(trmsg[sidFuel] + ': ' + inttostr(i) +
-                         '%', cWhiteColor, fntSmall)
+            Gear^.Tex := RenderStringTex(trmsg[sidFuel] + ansistring(': ' + inttostr(i) +
+                         '%'), cWhiteColor, fntSmall)
             end
         end
 end;
@@ -5387,8 +5387,8 @@
     begin
     Gear^.Damage:= t;
     FreeTexture(Gear^.Tex);
-    Gear^.Tex := RenderStringTex(trmsg[sidFuel] + ': ' + inttostr(t) +
-              '%', cWhiteColor, fntSmall)
+    Gear^.Tex := RenderStringTex(trmsg[sidFuel] + ansistring(': ' + inttostr(t) +
+              '%'), cWhiteColor, fntSmall)
     end;
     if Gear^.Message and (gmUp or gmDown) <> 0 then
         begin
--- a/hedgewars/uGearsHedgehog.pas	Fri Feb 07 23:57:32 2014 +0400
+++ b/hedgewars/uGearsHedgehog.pas	Sat Feb 08 16:29:34 2014 +0400
@@ -648,9 +648,9 @@
     or (GameType = gmtDemo)  then
         begin
         if cnt <> 0 then
-            s:= trammo[Ammoz[ammo].NameId] + ' (+' + IntToStr(cnt) + ')'
+            s:= trammo[Ammoz[ammo].NameId] + ansistring(' (+' + IntToStr(cnt) + ')')
         else
-            s:= trammo[Ammoz[ammo].NameId] + ' (+' + IntToStr(Ammoz[ammo].NumberInCase) + ')';
+            s:= trammo[Ammoz[ammo].NameId] + ansistring(' (+' + IntToStr(Ammoz[ammo].NumberInCase) + ')');
         AddCaption(s, HH.Team^.Clan^.Color, capgrpAmmoinfo);
 
         // show ammo icon
--- a/hedgewars/uLocale.pas	Fri Feb 07 23:57:32 2014 +0400
+++ b/hedgewars/uLocale.pas	Sat Feb 08 16:29:34 2014 +0400
@@ -63,10 +63,10 @@
             continue;
         TryDo(Length(s) > 6, 'Load locale: empty string', true);
         val(s[1]+s[2], a, c);
-        TryDo(c = 0, 'Load locale: numbers should be two-digit: ' + s, true);
+        TryDo(c = 0, ansistring('Load locale: numbers should be two-digit: ') + s, true);
         TryDo(s[3] = ':', 'Load locale: ":" expected', true);
         val(s[4]+s[5], b, c);
-        TryDo(c = 0, 'Load locale: numbers should be two-digit' + s, true);
+        TryDo(c = 0, ansistring('Load locale: numbers should be two-digit: ') + s, true);
         TryDo(s[6] = '=', 'Load locale: "=" expected', true);
         Delete(s, 1, 6);
         case a of
--- a/hedgewars/uPhysFSLayer.pas	Fri Feb 07 23:57:32 2014 +0400
+++ b/hedgewars/uPhysFSLayer.pas	Sat Feb 08 16:29:34 2014 +0400
@@ -113,12 +113,12 @@
         b[byte(b[0])]:= c;
         if b[0] = #255 then
             begin
-            s:= s + b;
+            s:= s + ansistring(b);
             b[0]:= #0
             end
         end;
-        
-s:= s + b
+
+s:= s + ansistring(b)
 end;
 
 function pfsBlockRead(f: PFSFile; buf: pointer; size: Int64): Int64;
--- a/hedgewars/uStore.pas	Fri Feb 07 23:57:32 2014 +0400
+++ b/hedgewars/uStore.pas	Sat Feb 08 16:29:34 2014 +0400
@@ -450,7 +450,7 @@
 for ai:= Low(TAmmoType) to High(TAmmoType) do
     with Ammoz[ai] do
         begin
-        TryDo(trAmmo[NameId] <> '','No default text/translation found for ammo type #' + intToStr(ord(ai)) + '!',true);
+        TryDo(length(trAmmo[NameId]) > 0,'No default text/translation found for ammo type #' + intToStr(ord(ai)) + '!',true);
         tmpsurf:= TTF_RenderUTF8_Blended(Fontz[CheckCJKFont(trAmmo[NameId],fnt16)].Handle, Str2PChar(trAmmo[NameId]), cWhiteColorChannels);
         TryDo(tmpsurf <> nil,'Name-texture creation for ammo type #' + intToStr(ord(ai)) + ' failed!',true);
         tmpsurf:= doSurfaceConversion(tmpsurf);
@@ -1238,10 +1238,10 @@
     tmpline, tmpline2, tmpdesc: ansistring;
 begin
 // make sure there is a caption as well as a sub caption - description is optional
-if caption = '' then
-    caption:= '???';
-if subcaption = '' then
-    subcaption:= _S' ';
+if length(caption) = 0 then
+    caption:= ansistring('???');
+if length(caption) = 0 then
+    subcaption:= ansistring(_S' ');
 
 font:= CheckCJKFont(caption,fnt16);
 font:= CheckCJKFont(subcaption,font);
@@ -1285,7 +1285,7 @@
         end
     end;
 
-if extra <> '' then
+if length(extra) > 0 then
     begin
     // get extra label's dimensions
     TTF_SizeUTF8(Fontz[font].Handle, PChar(extra), @i, @j);
@@ -1332,7 +1332,7 @@
         end
     end;
 
-if extra <> '' then
+if length(extra) > 0 then
     r:= WriteInRect(tmpsurf, cFontBorder + 2, r.y + r.h, extracolor, font, PChar(extra));
 
 r.x:= cFontBorder + 6;