- Use IntToStr() in preference to Str()
authorunc0rr
Sun, 15 May 2016 14:29:37 +0300
changeset 11827 4600dcb9db4f
parent 11826 d8844d4c67de
child 11828 0fba6cb098a1
- Use IntToStr() in preference to Str() - Remove senseless Str() call in uRandom.GetNext
hedgewars/uGearsHedgehog.pas
hedgewars/uGearsUtils.pas
hedgewars/uRandom.pas
hedgewars/uStore.pas
hedgewars/uVisualGearsHandlers.pas
--- a/hedgewars/uGearsHedgehog.pas	Sun May 15 13:18:34 2016 +0200
+++ b/hedgewars/uGearsHedgehog.pas	Sun May 15 14:29:37 2016 +0300
@@ -732,8 +732,7 @@
                     PlaySound(sndShotgunReload);
                     inc(HH^.Health, Gear^.Health);
                     HH^.Hedgehog^.Effects[hePoisoned] := 0;
-                    str(Gear^.Health, s);
-                    s:= '+' + s;
+                    s:= '+' + IntToStr(Gear^.Health);
                     AddCaption(ansistring(s), HH^.Hedgehog^.Team^.Clan^.Color, capgrpAmmoinfo);
                     RenderHealth(HH^.Hedgehog^);
                     RecountTeamHealth(HH^.Hedgehog^.Team);
--- a/hedgewars/uGearsUtils.pas	Sun May 15 13:18:34 2016 +0200
+++ b/hedgewars/uGearsUtils.pas	Sun May 15 14:29:37 2016 +0300
@@ -274,8 +274,7 @@
                     // was considering pulsing on attack, Tiy thinks it should be permanent while in play
                     //CurrentHedgehog^.Gear^.State:= CurrentHedgehog^.Gear^.State or gstVampiric;
                     inc(CurrentHedgehog^.Gear^.Health,vampDmg);
-                    str(vampDmg, s);
-                    s:= '+' + s;
+                    s:= '+' + IntToStr(vampDmg);
                     AddCaption(ansistring(s), CurrentHedgehog^.Team^.Clan^.Color, capgrpAmmoinfo);
                     RenderHealth(CurrentHedgehog^);
                     RecountTeamHealth(CurrentHedgehog^.Team);
--- a/hedgewars/uRandom.pas	Sun May 15 13:18:34 2016 +0200
+++ b/hedgewars/uRandom.pas	Sun May 15 14:29:37 2016 +0300
@@ -49,16 +49,14 @@
 end;
 
 function GetNext: Longword; inline;
-var s : string;
 begin
-n:= (n + 1) and $3F;
-cirbuf[n]:=
+    n:= (n + 1) and $3F;
+    cirbuf[n]:=
            (cirbuf[(n + 40) and $3F] +           {n - 24 mod 64}
             cirbuf[(n +  9) and $3F])            {n - 55 mod 64}
             and $7FFFFFFF;                       {mod 2^31}
 
-   GetNext:= cirbuf[n];
-   str(GetNext, s);
+    GetNext:= cirbuf[n];
 end;
 
 procedure SetRandomSeed(Seed: shortstring; dropAdditionalPart: boolean);
--- a/hedgewars/uStore.pas	Sun May 15 13:18:34 2016 +0200
+++ b/hedgewars/uStore.pas	Sun May 15 14:29:37 2016 +0300
@@ -578,7 +578,7 @@
 procedure RenderHealth(var Hedgehog: THedgehog);
 var s: shortstring;
 begin
-str(Hedgehog.Gear^.Health, s);
+s:= IntToStr(Hedgehog.Gear^.Health);
 FreeAndNilTexture(Hedgehog.HealthTagTex);
 Hedgehog.HealthTagTex:= RenderStringTex(ansistring(s), Hedgehog.Team^.Clan^.Color, fnt16)
 end;
--- a/hedgewars/uVisualGearsHandlers.pas	Sun May 15 13:18:34 2016 +0200
+++ b/hedgewars/uVisualGearsHandlers.pas	Sun May 15 14:29:37 2016 +0300
@@ -75,7 +75,7 @@
 procedure initModule;
 
 implementation
-uses uCollisions, uVariables, Math, uConsts, uVisualGearsList, uFloat, uSound, uRenderUtils, uWorld;
+uses uCollisions, uVariables, Math, uConsts, uVisualGearsList, uFloat, uSound, uRenderUtils, uWorld, uUtils;
 
 procedure doStepFlake(Gear: PVisualGear; Steps: Longword);
 var sign: real;
@@ -697,9 +697,8 @@
 procedure doStepHealthTag(Gear: PVisualGear; Steps: Longword);
 var s: shortstring;
 begin
-s:= '';
+s:= IntToStr(Gear^.State);
 
-str(Gear^.State, s);
 if Gear^.Hedgehog <> nil then
     Gear^.Tex:= RenderStringTex(ansistring(s), Gear^.Hedgehog^.Team^.Clan^.Color, fnt16)
 else