Even more explicit type conversions and other stuff to help pas2c use ansistrings
authorunc0rr
Sun, 09 Feb 2014 00:44:29 +0400
changeset 10124 aabd1b75d5a3
parent 10123 64e72781d344
child 10125 7a77a819a94d
Even more explicit type conversions and other stuff to help pas2c use ansistrings
hedgewars/LuaPas.pas
hedgewars/pas2cSystem.pas
hedgewars/uCaptions.pas
hedgewars/uGears.pas
hedgewars/uGearsHedgehog.pas
hedgewars/uGearsUtils.pas
hedgewars/uLandTemplates.pas
hedgewars/uLandTexture.pas
hedgewars/uMisc.pas
hedgewars/uTeams.pas
hedgewars/uUtils.pas
hedgewars/uVariables.pas
hedgewars/uVisualGearsHandlers.pas
hedgewars/uWorld.pas
project_files/hwc/rtl/fpcrtl.h
project_files/hwc/rtl/misc.h
project_files/hwc/rtl/system.h
tools/pas2c/Pas2C.hs
--- a/hedgewars/LuaPas.pas	Sat Feb 08 16:29:34 2014 +0400
+++ b/hedgewars/LuaPas.pas	Sun Feb 09 00:44:29 2014 +0400
@@ -476,7 +476,8 @@
 procedure lua_setglobal(L : Plua_State; s : PChar);
 procedure lua_getglobal(L : Plua_State; s : PChar);
 
-function lua_tostring(L : Plua_State; idx : LongInt) : AnsiString;
+function lua_tostring(L : Plua_State; idx : LongInt) : shortstring;
+function lua_tostringA(L : Plua_State; idx : LongInt) : ansistring;
 
 
 (*
@@ -921,11 +922,16 @@
     lua_getfield(L, LUA_GLOBALSINDEX, s);
 end;
 
-function lua_tostring(L : Plua_State; idx : LongInt) : AnsiString;
+function lua_tostring(L : Plua_State; idx : LongInt) : shortstring;
 begin
     lua_tostring := StrPas(lua_tolstring(L, idx, nil));
 end;
 
+function lua_tostringA(L : Plua_State; idx : LongInt) : ansistring;
+begin
+    lua_tostringA := ansistring(lua_tolstring(L, idx, nil));
+end;
+
 function lua_open : Plua_State;
 begin
     lua_open := luaL_newstate;
--- a/hedgewars/pas2cSystem.pas	Sat Feb 08 16:29:34 2014 +0400
+++ b/hedgewars/pas2cSystem.pas	Sun Feb 09 00:44:29 2014 +0400
@@ -115,7 +115,7 @@
     TThreadId : function : integer;
 
     _strconcat, _strappend, _strprepend, _chrconcat : function : string;
-    _strcompare, _strncompare, _strcomparec : function : boolean;
+    _strcompare, _strncompare, _strcomparec, _strncompareA : function : boolean;
     _strconcatA, _strappendA : function : ansistring;
 
     png_structp, png_set_write_fn, png_get_io_ptr,
--- a/hedgewars/uCaptions.pas	Sat Feb 08 16:29:34 2014 +0400
+++ b/hedgewars/uCaptions.pas	Sun Feb 09 00:44:29 2014 +0400
@@ -23,7 +23,7 @@
 interface
 uses uTypes;
 
-procedure AddCaption(s: shortstring; Color: Longword; Group: TCapGroup);
+procedure AddCaption(s: ansistring; Color: Longword; Group: TCapGroup);
 procedure DrawCaptions;
 procedure ReloadCaptions(unload: boolean);
 
@@ -36,13 +36,13 @@
 type TCaptionStr = record
     Tex: PTexture;
     EndTime: LongWord;
-    Text: shortstring;
+    Text: ansistring;
     Color: Longword
     end;
 var
     Captions: array[TCapGroup] of TCaptionStr;
 
-procedure AddCaption(s: shortstring; Color: Longword; Group: TCapGroup);
+procedure AddCaption(s: ansistring; Color: Longword; Group: TCapGroup);
 begin
     if cOnlyStats then exit;
     if Length(s) = 0 then
@@ -74,7 +74,7 @@
 for Group:= Low(TCapGroup) to High(TCapGroup) do
     if unload then
         FreeTexture(Captions[Group].Tex)
-    else if Captions[Group].Text <> '' then
+    else if length(Captions[Group].Text) > 0 then
         Captions[Group].Tex:= RenderStringTex(Captions[Group].Text, Captions[Group].Color, fntBig)
 end;
 
@@ -99,7 +99,7 @@
                     begin
                     FreeTexture(Tex);
                     Tex:= nil;
-                    Text:= '';
+                    Text:= ansistring('');
                     EndTime:= 0
                     end;
                 end;
--- a/hedgewars/uGears.pas	Sat Feb 08 16:29:34 2014 +0400
+++ b/hedgewars/uGears.pas	Sun Feb 09 00:44:29 2014 +0400
@@ -166,7 +166,7 @@
 procedure ProcessGears;
 var t: PGear;
     i, AliveCount: LongInt;
-    s: shortstring;
+    s: ansistring;
     prevtime: LongWord;
 begin
 prevtime:= TurnTimeLeft;
@@ -216,7 +216,7 @@
             if curHandledGear^.RenderTimer and (curHandledGear^.Timer > 500) and ((curHandledGear^.Timer mod 1000) = 0) then
                 begin
                 FreeTexture(curHandledGear^.Tex);
-                curHandledGear^.Tex:= RenderStringTex(inttostr(curHandledGear^.Timer div 1000), cWhiteColor, fntSmall);
+                curHandledGear^.Tex:= RenderStringTex(ansistring(inttostr(curHandledGear^.Timer div 1000)), cWhiteColor, fntSmall);
                 end;
             curHandledGear^.doStep(curHandledGear);
             // might be useful later
@@ -327,11 +327,11 @@
                 else if (TotalRounds < cSuddenDTurns) and (not isInMultiShoot) then
                     begin
                     i:= cSuddenDTurns - TotalRounds;
-                    s:= inttostr(i);
+                    s:= ansistring(inttostr(i));
                     if i = 1 then
                         AddCaption(trmsg[sidRoundSD], cWhiteColor, capgrpGameState)
                     else if (i = 2) or ((i > 0) and ((i mod 50 = 0) or ((i <= 25) and (i mod 5 = 0)))) then
-                        AddCaption(Format(trmsg[sidRoundsSD], s), cWhiteColor, capgrpGameState);
+                        AddCaption(FormatA(trmsg[sidRoundsSD], s), cWhiteColor, capgrpGameState);
                     end;
                 end;
             if bBetweenTurns
--- a/hedgewars/uGearsHedgehog.pas	Sat Feb 08 16:29:34 2014 +0400
+++ b/hedgewars/uGearsHedgehog.pas	Sun Feb 09 00:44:29 2014 +0400
@@ -517,7 +517,7 @@
 end;
 
 procedure AfterAttack;
-var s: shortstring;
+var s: ansistring;
     a: TAmmoType;
     HHGear: PGear;
 begin
@@ -532,8 +532,8 @@
 
         if (Ammoz[a].Ammo.NumPerTurn >= MultiShootAttacks) then
             begin
-            s:= inttostr(Ammoz[a].Ammo.NumPerTurn - MultiShootAttacks + 1);
-            AddCaption(format(trmsg[sidRemaining], s), cWhiteColor, capgrpAmmostate);
+            s:= ansistring(inttostr(Ammoz[a].Ammo.NumPerTurn - MultiShootAttacks + 1));
+            AddCaption(formatA(trmsg[sidRemaining], s), cWhiteColor, capgrpAmmostate);
             end;
 
         if (Ammoz[a].Ammo.NumPerTurn >= MultiShootAttacks)
@@ -636,7 +636,7 @@
 end;
 
 procedure AddPickup(HH: THedgehog; ammo: TAmmoType; cnt, X, Y: LongWord);
-var s: shortstring;
+var s: ansistring;
     vga: PVisualGear;
 begin
     if cnt <> 0 then AddAmmo(HH, ammo, cnt)
@@ -714,7 +714,7 @@
                     HH^.Hedgehog^.Effects[hePoisoned] := 0;
                     str(Gear^.Health, s);
                     s:= '+' + s;
-                    AddCaption(s, HH^.Hedgehog^.Team^.Clan^.Color, capgrpAmmoinfo);
+                    AddCaption(ansistring(s), HH^.Hedgehog^.Team^.Clan^.Color, capgrpAmmoinfo);
                     RenderHealth(HH^.Hedgehog^);
                     RecountTeamHealth(HH^.Hedgehog^.Team);
 
@@ -1234,6 +1234,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 procedure doStepHedgehogFree(Gear: PGear);
 var prevState: Longword;
+    s: ansistring;
 begin
 prevState:= Gear^.State;
 
@@ -1268,7 +1269,8 @@
                 Gear^.State:= (Gear^.State or gstHHDeath) and (not gstAnimation);
                 Gear^.doStep:= @doStepHedgehogDead;
                 // Death message
-                AddCaption(Format(GetEventString(eidDied), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage);
+                s:= ansistring(Gear^.Hedgehog^.Name);
+                AddCaption(FormatA(GetEventString(eidDied), s), cWhiteColor, capgrpMessage);
                 end;
             end
         else
@@ -1277,7 +1279,8 @@
             Gear^.doStep:= @doStepHedgehogGone;
 
             // Gone message
-            AddCaption(Format(GetEventString(eidGone), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage);
+            s:= ansistring(Gear^.Hedgehog^.Name);
+            AddCaption(FormatA(GetEventString(eidGone), s), cWhiteColor, capgrpMessage);
             end
         end;
     exit
--- a/hedgewars/uGearsUtils.pas	Sat Feb 08 16:29:34 2014 +0400
+++ b/hedgewars/uGearsUtils.pas	Sun Feb 09 00:44:29 2014 +0400
@@ -234,7 +234,7 @@
                     inc(CurrentHedgehog^.Gear^.Health,vampDmg);
                     str(vampDmg, s);
                     s:= '+' + s;
-                    AddCaption(s, CurrentHedgehog^.Team^.Clan^.Color, capgrpAmmoinfo);
+                    AddCaption(ansistring(s), CurrentHedgehog^.Team^.Clan^.Color, capgrpAmmoinfo);
                     RenderHealth(CurrentHedgehog^);
                     RecountTeamHealth(CurrentHedgehog^.Team);
                     i:= 0;
@@ -364,6 +364,7 @@
     vdX, vdY: real;
     particle, splash: PVisualGear;
     isSubmersible: boolean;
+    s: ansistring;
 begin
     // probably needs tweaking. might need to be in a case statement based upon gear type
     Y:= hwRound(Gear^.Y);
@@ -419,7 +420,8 @@
                             begin
                             Gear^.doStep := @doStepDrowningGear;
                             Gear^.State := Gear^.State and (not gstHHDriven);
-                            AddCaption(Format(GetEventString(eidDrowned), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage);
+                            s:= ansistring(Gear^.Hedgehog^.Name);
+                            AddCaption(FormatA(GetEventString(eidDrowned), s), cWhiteColor, capgrpMessage);
                             end
                         end
                     else
@@ -517,7 +519,7 @@
             begin
             inc(Team^.stats.AIKills);
             FreeTexture(Team^.AIKillsTex);
-            Team^.AIKillsTex := RenderStringTex(inttostr(Team^.stats.AIKills), Team^.Clan^.Color, fnt16);
+            Team^.AIKillsTex := RenderStringTex(ansistring(inttostr(Team^.stats.AIKills)), Team^.Clan^.Color, fnt16);
             end;
     tempTeam := gear^.Hedgehog^.Team;
     DeleteCI(gear);
--- a/hedgewars/uLandTemplates.pas	Sat Feb 08 16:29:34 2014 +0400
+++ b/hedgewars/uLandTemplates.pas	Sun Feb 09 00:44:29 2014 +0400
@@ -65,7 +65,7 @@
       );
       Template0FPoints: array[0..0] of TPoint =
       (
-       (X: 1023; Y:    0)
+       (x: 1023; y:    0)
       );
 
 const Template1Points: array[0..15] of TSDL_Rect =
@@ -89,7 +89,7 @@
       );
       Template1FPoints: array[0..0] of TPoint =
       (
-       (X: 1023; Y:    0)
+       (x: 1023; y:    0)
       );
 
 const Template2Points: array[0..21] of TSDL_Rect =
@@ -119,7 +119,7 @@
       );
       Template2FPoints: array[0..0] of TPoint =
       (
-       (X: 1023; Y:    0)
+       (x: 1023; y:    0)
       );
 
 const Template3Points: array[0..16] of TSDL_Rect =
@@ -144,7 +144,7 @@
       );
       Template3FPoints: array[0..0] of TPoint =
       (
-       (X: 1023; Y:    0)
+       (x: 1023; y:    0)
       );
 
 const Template4Points: array[0..22] of TSDL_Rect =
@@ -175,7 +175,7 @@
       );
       Template4FPoints: array[0..0] of TPoint =
       (
-       (X: 1023; Y:    0)
+       (x: 1023; y:    0)
       );
 
 const Template5Points: array[0..15] of TSDL_Rect =
@@ -199,7 +199,7 @@
        );
       Template5FPoints: array[0..0] of TPoint =
       (
-       (X: 1023; Y:    0)
+       (x: 1023; y:    0)
       );
 
 const Template6Points: array[0..13] of TSDL_Rect =
@@ -221,7 +221,7 @@
        );
       Template6FPoints: array[0..0] of TPoint =
       (
-       (X: 1023; Y:    0)
+       (x: 1023; y:    0)
       );
 
 const Template7Points: array[0..5] of TSDL_Rect =
@@ -235,7 +235,7 @@
       );
       Template7FPoints: array[0..0] of TPoint =
       (
-       (X: 1023; Y:    0)
+       (x: 1023; y:    0)
       );
 
 
@@ -264,7 +264,7 @@
       );
       Template8FPoints: array[0..0] of TPoint =
       (
-       (X: 1023; Y:    0)
+       (x: 1023; y:    0)
       );
 
 const Template9Points: array[0..31] of TSDL_Rect =
@@ -304,7 +304,7 @@
       );
       Template9FPoints: array[0..0] of TPoint =
       (
-       (X: 1023; Y:    0)
+       (x: 1023; y:    0)
       );
 
 const Template10Points: array[0..13] of TSDL_Rect =
@@ -326,7 +326,7 @@
       );
       Template10FPoints: array[0..0] of TPoint =
       (
-       (X: 1023; Y:    0)
+       (x: 1023; y:    0)
       );
 
 const Template11Points: array[0..9] of TSDL_Rect =
@@ -344,7 +344,7 @@
       );
       Template11FPoints: array[0..0] of TPoint =
       (
-       (X: 1023; Y:    0)
+       (x: 1023; y:    0)
       );
 
 const Template12Points: array[0..13] of TSDL_Rect =
@@ -366,7 +366,7 @@
       );
       Template12FPoints: array[0..0] of TPoint =
       (
-       (X: 1023; Y:    0)
+       (x: 1023; y:    0)
       );
 
 const Template13Points: array[0..15] of TSDL_Rect =
@@ -390,7 +390,7 @@
       );
       Template13FPoints: array[0..0] of TPoint =
       (
-       (X: 1023; Y:    0)
+       (x: 1023; y:    0)
       );
 
 const Template14Points: array[0..13] of TSDL_Rect =
@@ -412,7 +412,7 @@
       );
       Template14FPoints: array[0..0] of TPoint =
       (
-       (X: 1023; Y:    0)
+       (x: 1023; y:    0)
       );
 
 const Template15Points: array[0..23] of TSDL_Rect =
@@ -444,7 +444,7 @@
       );
       Template15FPoints: array[0..0] of TPoint =
       (
-       (X: 1023; Y:    0)
+       (x: 1023; y:    0)
       );
 
 const Template16Points: array[0..28] of TSDL_Rect =
@@ -481,7 +481,7 @@
       );
       Template16FPoints: array[0..0] of TPoint =
       (
-       (X: 1023; Y:    0)
+       (x: 1023; y:    0)
       );
 
 const Template17Points: array[0..13] of TSDL_Rect =
@@ -503,7 +503,7 @@
       );
       Template17FPoints: array[0..0] of TPoint =
       (
-       (X: 1023; Y:    0)
+       (x: 1023; y:    0)
       );
 //////////////////// MIXING AND MATCHING ORIGINAL //////////////////////////////////////
 const Template18Points: array[0..32] of TSDL_Rect =
@@ -544,7 +544,7 @@
       );
       Template18FPoints: array[0..0] of TPoint =
       (
-       (X: 2047; Y:    0)
+       (x: 2047; y:    0)
       );
 
 const Template19Points: array[0..44] of TSDL_Rect =
@@ -597,7 +597,7 @@
       );
       Template19FPoints: array[0..0] of TPoint =
       (
-       (X: 2047; Y:    0)
+       (x: 2047; y:    0)
       );
 
 const Template20Points: array[0..45] of TSDL_Rect =
@@ -651,7 +651,7 @@
       );
       Template20FPoints: array[0..0] of TPoint =
       (
-       (X: 2047; Y:    0)
+       (x: 2047; y:    0)
       );
 
 const Template21Points: array[0..30] of TSDL_Rect =
@@ -690,7 +690,7 @@
       );
       Template21FPoints: array[0..0] of TPoint =
       (
-       (X: 2047; Y:    0)
+       (x: 2047; y:    0)
       );
 
 const Template22Points: array[0..38] of TSDL_Rect =
@@ -737,7 +737,7 @@
       );
       Template22FPoints: array[0..0] of TPoint =
       (
-       (X: 2047; Y:    0)
+       (x: 2047; y:    0)
       );
 
 const Template23Points: array[0..29] of TSDL_Rect =
@@ -775,7 +775,7 @@
        );
       Template23FPoints: array[0..0] of TPoint =
       (
-       (X: 2047; Y:    0)
+       (x: 2047; y:    0)
       );
 
 const Template24Points: array[0..23] of TSDL_Rect =
@@ -807,7 +807,7 @@
        );
       Template24FPoints: array[0..0] of TPoint =
       (
-       (X: 2047; Y:    0)
+       (x: 2047; y:    0)
       );
 
 const Template25Points: array[0..19] of TSDL_Rect =
@@ -835,7 +835,7 @@
       );
       Template25FPoints: array[0..0] of TPoint =
       (
-       (X: 2047; Y:    0)
+       (x: 2047; y:    0)
       );
 
 
@@ -896,7 +896,7 @@
       );
       Template26FPoints: array[0..0] of TPoint =
       (
-       (X: 2047; Y:    0)
+       (x: 2047; y:    0)
       );
 
 const Template27Points: array[0..42] of TSDL_Rect =
@@ -947,7 +947,7 @@
       );
       Template27FPoints: array[0..0] of TPoint =
       (
-       (X: 2047; Y:    0)
+       (x: 2047; y:    0)
       );
 
 const Template28Points: array[0..29] of TSDL_Rect =
@@ -985,7 +985,7 @@
       );
       Template28FPoints: array[0..0] of TPoint =
       (
-       (X: 2047; Y:    0)
+       (x: 2047; y:    0)
       );
 
 const Template29Points: array[0..37] of TSDL_Rect =
@@ -1031,7 +1031,7 @@
       );
       Template29FPoints: array[0..0] of TPoint =
       (
-       (X: 2047; Y:    0)
+       (x: 2047; y:    0)
       );
 
 const Template30Points: array[0..30] of TSDL_Rect =
@@ -1070,7 +1070,7 @@
       );
       Template30FPoints: array[0..0] of TPoint =
       (
-       (X: 2047; Y:    0)
+       (x: 2047; y:    0)
       );
 
 const Template31Points: array[0..32] of TSDL_Rect =
@@ -1111,7 +1111,7 @@
       );
       Template31FPoints: array[0..0] of TPoint =
       (
-       (X: 2047; Y:    0)
+       (x: 2047; y:    0)
       );
 
 const Template32Points: array[0..29] of TSDL_Rect =
@@ -1149,7 +1149,7 @@
       );
       Template32FPoints: array[0..0] of TPoint =
       (
-         (X: 2047; Y:    0)
+         (x: 2047; y:    0)
       );
 
 const Template33Points: array[0..45] of TSDL_Rect =
@@ -1203,7 +1203,7 @@
       );
       Template33FPoints: array[0..0] of TPoint =
       (
-       (X: 2047; Y:    0)
+       (x: 2047; y:    0)
       );
 
 const Template34Points: array[0..25] of TSDL_Rect =
@@ -1237,7 +1237,7 @@
       );
       Template34FPoints: array[0..0] of TPoint =
       (
-       (X: 2047; Y:    0)
+       (x: 2047; y:    0)
       );
 
 const Template35Points: array[0..48] of TSDL_Rect =
@@ -1294,7 +1294,7 @@
       );
       Template35FPoints: array[0..0] of TPoint =
       (
-       (X: 2047; Y:    0)
+       (x: 2047; y:    0)
       );
 
 ///////////////////////// CAVERNS ///////////////////////////////////
@@ -1322,7 +1322,7 @@
       );
       Template36FPoints: array[0..0] of TPoint =
       (
-       (X: 2047; Y:    0)
+       (x: 2047; y:    0)
       );
 ////////////////////////////// ... Silly ...  ////////////////////////////////
 /// Ok. Tiy does not care for these.  Perhaps they could be saved.
@@ -1363,7 +1363,7 @@
       );
       Template37FPoints: array[0..0] of TPoint =
       (
-       (X: 2047; Y:    0)
+       (x: 2047; y:    0)
       );
 // attempt to make a series of moderate hills/valleys - was before I really figured out the whole probabilities thing
 const Template38Points: array[0..16] of TSDL_Rect =
@@ -1388,7 +1388,7 @@
       );
       Template38FPoints: array[0..0] of TPoint =
       (
-       (X: 2047; Y:    0)
+       (x: 2047; y:    0)
       );
 
 // 8 tiny islands
@@ -1437,7 +1437,7 @@
       );
       Template39FPoints: array[0..0] of TPoint =
       (
-       (X: 512; Y:    0)
+       (x: 512; y:    0)
       );
 const Template40Points: array[0..7] of TSDL_Rect =
       (
@@ -1452,7 +1452,7 @@
       );
       Template40FPoints: array[0..0] of TPoint =
       (
-       (X: 512; Y:    0)
+       (x: 512; y:    0)
       );
 // Many islands
 const Template41Points: array[0..86] of TSDL_Rect =
@@ -1547,7 +1547,7 @@
       );
       Template41FPoints: array[0..0] of TPoint =
       (
-       (X: 2047; Y:    0)
+       (x: 2047; y:    0)
       );
 // 2 tiny islands
 const Template42Points: array[0..13] of TSDL_Rect =
@@ -1569,7 +1569,7 @@
       );
       Template42FPoints: array[0..0] of TPoint =
       (
-       (X: 512; Y:    0)
+       (x: 512; y:    0)
       );
 // Many islands
 const Template43Points: array[0..173] of TSDL_Rect =
@@ -1751,7 +1751,7 @@
       );
       Template43FPoints: array[0..0] of TPoint =
       (
-       (X: 4095; Y:    0)
+       (x: 4095; y:    0)
       );
 
 // 3 large caverns
@@ -1775,12 +1775,12 @@
       );
       Template44FPoints: array[0..5] of TSDL_Rect =
       (
-       (X:   1; Y:  90; w:   0; h:   0),
-       (X:   1; Y: 500; w:   0; h:   0),
-       (X:4095; Y: 500; w:   0; h:   0),
-       (X:   1; Y:1200; w:   0; h:   0),
-       (X:4095; Y:1200; w:   0; h:   0),
-       (X:   1; Y:2010; w:   0; h:   0)
+       (x:   1; y:  90; w:   0; h:   0),
+       (x:   1; y: 500; w:   0; h:   0),
+       (x:4095; y: 500; w:   0; h:   0),
+       (x:   1; y:1200; w:   0; h:   0),
+       (x:4095; y:1200; w:   0; h:   0),
+       (x:   1; y:2010; w:   0; h:   0)
       );
 
 // large caverns with an island
@@ -1801,9 +1801,9 @@
       );
       Template45FPoints: array[0..2] of TSDL_Rect =
       (
-       (X:   1; Y:   1; w:   0; h:   0),
-       (X:   1; Y:2047; w:   0; h:   0),
-       (X:1005; Y: 805; w:   0; h:   0)
+       (x:   1; y:   1; w:   0; h:   0),
+       (x:   1; y:2047; w:   0; h:   0),
+       (x:1005; y: 805; w:   0; h:   0)
       );
 
 ////////////////////////////////////////////////////////////////////////
--- a/hedgewars/uLandTexture.pas	Sat Feb 08 16:29:34 2014 +0400
+++ b/hedgewars/uLandTexture.pas	Sun Feb 09 00:44:29 2014 +0400
@@ -34,7 +34,7 @@
 
 const TEXSIZE = 128;
       // in avoid tile borders stretch the blurry texture by 1 pixel more
-      BLURRYLANDOVERLAP = 1 / TEXSIZE / 2.0; // 1 pixel divided by texsize and blurry land scale factor
+      BLURRYLANDOVERLAP: real = 1 / TEXSIZE / 2.0; // 1 pixel divided by texsize and blurry land scale factor
 
 type TLandRecord = record
             shouldUpdate, landAdded: boolean;
--- a/hedgewars/uMisc.pas	Sat Feb 08 16:29:34 2014 +0400
+++ b/hedgewars/uMisc.pas	Sun Feb 09 00:44:29 2014 +0400
@@ -293,7 +293,7 @@
 end;
 
 function GetTeamStatString(p: PTeam): shortstring;
-var s: ansistring;
+var s: shortstring;
 begin
     s:= p^.TeamName + ':' + IntToStr(p^.TeamHealth) + ':';
     GetTeamStatString:= s;
--- a/hedgewars/uTeams.pas	Sat Feb 08 16:29:34 2014 +0400
+++ b/hedgewars/uTeams.pas	Sun Feb 09 00:44:29 2014 +0400
@@ -53,7 +53,7 @@
 
 function CheckForWin: boolean;
 var AliveClan: PClan;
-    s: shortstring;
+    s, ts: ansistring;
     t, AliveCount, i, j: LongInt;
 begin
 CheckForWin:= false;
@@ -81,16 +81,17 @@
     if AliveCount = 0 then
         begin // draw
         AddCaption(trmsg[sidDraw], cWhiteColor, capgrpGameState);
-        SendStat(siGameResult, trmsg[sidDraw]);
+        SendStat(siGameResult, shortstring(trmsg[sidDraw]));
         AddGear(0, 0, gtATFinishGame, 0, _0, _0, 3000)
         end
     else // win
         with AliveClan^ do
             begin
+            ts:= ansistring(Teams[0]^.TeamName);
             if TeamsNumber = 1 then
-                s:= Format(shortstring(trmsg[sidWinner]), Teams[0]^.TeamName)  // team wins
+                s:= FormatA(trmsg[sidWinner], ts)  // team wins
             else
-                s:= Format(shortstring(trmsg[sidWinner]), Teams[0]^.TeamName); // clan wins
+                s:= FormatA(trmsg[sidWinner], ts); // clan wins
 
             for j:= 0 to Pred(TeamsNumber) do
                 with Teams[j]^ do
@@ -104,7 +105,7 @@
                 AddVoice(sndVictory, Teams[0]^.voicepack);
 
             AddCaption(s, cWhiteColor, capgrpGameState);
-            SendStat(siGameResult, s);
+            SendStat(siGameResult, shortstring(s));
             AddGear(0, 0, gtATFinishGame, 0, _0, _0, 3000)
             end;
     SendStats;
@@ -237,7 +238,7 @@
     CurWeapon: PAmmo;
     w: real;
     vg: PVisualGear;
-
+    s: ansistring;
 begin
 if PlacingHogs then
     begin
@@ -334,7 +335,8 @@
         end;
     if cHedgehogTurnTime < 1000000 then
         ReadyTimeLeft:= cReadyDelay;
-    AddCaption(Format(shortstring(trmsg[sidReady]), CurrentTeam^.TeamName), cWhiteColor, capgrpGameState)
+    s:= ansistring(CurrentTeam^.TeamName);
+    AddCaption(FormatA(trmsg[sidReady], s), cWhiteColor, capgrpGameState)
     end
 else
     begin
--- a/hedgewars/uUtils.pas	Sat Feb 08 16:29:34 2014 +0400
+++ b/hedgewars/uUtils.pas	Sun Feb 09 00:44:29 2014 +0400
@@ -377,7 +377,7 @@
 {$ENDIF}
     exit;
 
-l:= Utf8ToUnicode(@tmpstr, Str2PChar(s), min(length(tmpstr), length(s)))-1;
+l:= Utf8ToUnicode(@tmpstr, PChar(s), min(length(tmpstr), length(s)))-1;
 i:= 0;
 
 while i < l do
--- a/hedgewars/uVariables.pas	Sat Feb 08 16:29:34 2014 +0400
+++ b/hedgewars/uVariables.pas	Sun Feb 09 00:44:29 2014 +0400
@@ -2397,7 +2397,9 @@
 procedure freeModule;
 
 implementation
+{$IFNDEF PAS2C}
 uses strutils;
+{$ENDIF}
 
 procedure preInitModule;
 begin
--- a/hedgewars/uVisualGearsHandlers.pas	Sat Feb 08 16:29:34 2014 +0400
+++ b/hedgewars/uVisualGearsHandlers.pas	Sun Feb 09 00:44:29 2014 +0400
@@ -619,7 +619,7 @@
 
 Gear^.Timer:= max(LongInt(Length(Gear^.Text)) * 150, 3000);
 
-Gear^.Tex:= RenderSpeechBubbleTex(Gear^.Text, Gear^.FrameTicks, fnt16);
+Gear^.Tex:= RenderSpeechBubbleTex(ansistring(Gear^.Text), Gear^.FrameTicks, fnt16);
 
 // FrameTicks cannot hold negative values
 case Gear^.FrameTicks of
@@ -662,9 +662,9 @@
 
 str(Gear^.State, s);
 if Gear^.Hedgehog <> nil then
-    Gear^.Tex:= RenderStringTex(s, Gear^.Hedgehog^.Team^.Clan^.Color, fnt16)
+    Gear^.Tex:= RenderStringTex(ansistring(s), Gear^.Hedgehog^.Team^.Clan^.Color, fnt16)
 else
-    Gear^.Tex:= RenderStringTex(s, cWhiteColor, fnt16);
+    Gear^.Tex:= RenderStringTex(ansistring(s), cWhiteColor, fnt16);
 
 Gear^.doStep:= @doStepHealthTagWork;
 
--- a/hedgewars/uWorld.pas	Sat Feb 08 16:29:34 2014 +0400
+++ b/hedgewars/uWorld.pas	Sun Feb 09 00:44:29 2014 +0400
@@ -1983,13 +1983,13 @@
     begin
     r.x:= 0;
     r.y:= icon * 32;
-    missionTex:= RenderHelpWindow(caption, subcaption, text, '', 0, MissionIcons, @r)
+    missionTex:= RenderHelpWindow(caption, subcaption, text, ansistring(''), 0, MissionIcons, @r)
     end
 else
     begin
     r.x:= ((-icon - 1) shr 4) * 32;
     r.y:= ((-icon - 1) mod 16) * 32;
-    missionTex:= RenderHelpWindow(caption, subcaption, text, '', 0, SpritesData[sprAMAmmos].Surface, @r)
+    missionTex:= RenderHelpWindow(caption, subcaption, text, ansistring(''), 0, SpritesData[sprAMAmmos].Surface, @r)
     end;
 end;
 
--- a/project_files/hwc/rtl/fpcrtl.h	Sat Feb 08 16:29:34 2014 +0400
+++ b/project_files/hwc/rtl/fpcrtl.h	Sun Feb 09 00:44:29 2014 +0400
@@ -189,6 +189,7 @@
 #define _strcomparec                        fpcrtl_strcomparec
 #define _chrconcat                          fpcrtl_chrconcat
 #define _pchar                              fpcrtl_pchar
+#define _strconcatA                         fpcrtl_strconcatA
 
 // hooks are implemented in javascript
 void start_hook(void);
--- a/project_files/hwc/rtl/misc.h	Sat Feb 08 16:29:34 2014 +0400
+++ b/project_files/hwc/rtl/misc.h	Sun Feb 09 00:44:29 2014 +0400
@@ -40,6 +40,8 @@
 string255   fpcrtl_strprepend(char c, string255 s);
 string255   fpcrtl_chrconcat(char a, char b);
 
+astring     fpcrtl_strconcatA(astring str1, astring str2);
+
 // return true if str1 == str2
 bool        fpcrtl_strcompare(string255 str1, string255 str2);
 bool        fpcrtl_strcomparec(string255 a, char b);
@@ -48,6 +50,8 @@
 char*       fpcrtl__pchar(string255 s);
 string255   fpcrtl_pchar2str(char *s);
 astring     fpcrtl_str2astr(string255 s);
+string255   fpcrtl_astr2str(astring s);
+string255   fpcrtl_astr2str(astring a);
 #define     fpcrtl_TypeInfo                         sizeof // dummy
 
 #ifdef EMSCRIPTEN
--- a/project_files/hwc/rtl/system.h	Sat Feb 08 16:29:34 2014 +0400
+++ b/project_files/hwc/rtl/system.h	Sun Feb 09 00:44:29 2014 +0400
@@ -45,6 +45,8 @@
 
 Integer     fpcrtl_length(string255 s);
 #define     fpcrtl_Length                                   fpcrtl_length
+Integer     fpcrtl_lengthA(astring s);
+#define     fpcrtl_LengthA                                  fpcrtl_lengthA
 
 #define     fpcrtl_sqr(x)                                   ((x) * (x))
 
--- a/tools/pas2c/Pas2C.hs	Sat Feb 08 16:29:34 2014 +0400
+++ b/tools/pas2c/Pas2C.hs	Sun Feb 09 00:44:29 2014 +0400
@@ -943,6 +943,7 @@
     case (op2C op, t1, t2) of
         ("+", BTAString, BTAString) -> expr2C $ BuiltInFunCall [expr1, expr2] (SimpleReference $ Identifier "_strconcatA" (BTFunction False [(False, t1), (False, t2)] BTString))
         ("+", BTAString, BTChar) -> expr2C $ BuiltInFunCall [expr1, expr2] (SimpleReference $ Identifier "_strappendA" (BTFunction False [(False, t1), (False, t2)] BTAString))
+        ("!=", BTAString, BTAString) -> expr2C $ BuiltInFunCall [expr1, expr2] (SimpleReference $ Identifier "_strncompareA" (BTFunction False [(False, t1), (False, t2)] BTBool))
         (_, BTAString, _) -> error $ "unhandled bin op with ansistring on the left side: " ++ show bop
         (_, _, BTAString) -> error $ "unhandled bin op with ansistring on the right side: " ++ show bop
         ("+", BTString, BTString) -> expr2C $ BuiltInFunCall [expr1, expr2] (SimpleReference $ Identifier "_strconcat" (BTFunction False [(False, t1), (False, t2)] BTString))
@@ -1199,6 +1200,7 @@
     case (map toLower i, lt) of
         ("pchar", BTString) -> ref2C $ FunCall [expr] (SimpleReference (Identifier "_pchar" $ BTPointerTo BTChar))
         ("pchar", BTAString) -> ref2C $ FunCall [expr] (SimpleReference (Identifier "_pcharA" $ BTPointerTo BTChar))
+        ("shortstring", BTAString) -> ref2C $ FunCall [expr] (SimpleReference (Identifier "astr2str" $ BTString))
         ("shortstring", BTPointerTo _) -> ref2C $ FunCall [expr] (SimpleReference (Identifier "pchar2str" $ BTString))
         ("ansistring", BTString) -> ref2C $ FunCall [expr] (SimpleReference (Identifier "str2astr" $ BTAString))
         (a, _) -> do