hedgewars/uTeams.pas
changeset 8370 0c79946e96f8
parent 8351 f895be37b607
child 8444 75db7bb8dce8
child 8560 134a098235fa
--- a/hedgewars/uTeams.pas	Thu Jan 10 22:54:55 2013 +0400
+++ b/hedgewars/uTeams.pas	Thu Jan 10 22:59:46 2013 +0400
@@ -40,7 +40,7 @@
 procedure SwitchCurrentHedgehog(newHog: PHedgehog);
 
 implementation
-uses uLocale, uAmmos, uChat, uVariables, uUtils, uIO, uCaptions, uCommands, uDebug, uScript,
+uses uLocale, uAmmos, uChat, uVariables, uUtils, uIO, uCaptions, uCommands, uDebug,
     uGearsUtils, uGearsList
     {$IFDEF USE_TOUCH_INTERFACE}, uTouch{$ENDIF};
 
@@ -503,7 +503,6 @@
 procedure chAddHH(var id: shortstring);
 var s: shortstring;
     Gear: PGear;
-    c: LongInt;
 begin
 s:= '';
 if (not isDeveloperMode) or (CurrentTeam = nil) then
@@ -512,10 +511,10 @@
     begin
     SplitBySpace(id, s);
     SwitchCurrentHedgehog(@Hedgehogs[HedgehogsNumber]);
-    val(id, CurrentHedgehog^.BotLevel, c);
+    CurrentHedgehog^.BotLevel:= StrToInt(id);
     Gear:= AddGear(0, 0, gtHedgehog, 0, _0, _0, 0);
     SplitBySpace(s, id);
-    val(s, Gear^.Health, c);
+    Gear^.Health:= StrToInt(s);
     TryDo(Gear^.Health > 0, 'Invalid hedgehog health', true);
     Gear^.Hedgehog^.Team:= CurrentTeam;
     if (GameFlags and gfSharedAmmo) <> 0 then
@@ -536,7 +535,6 @@
 
 procedure chAddTeam(var s: shortstring);
 var Color: Longword;
-    c: LongInt;
     ts, cs: shortstring;
 begin
 cs:= '';
@@ -545,7 +543,7 @@
     begin
     SplitBySpace(s, cs);
     SplitBySpace(cs, ts);
-    val(cs, Color, c);
+    Color:= StrToInt(cs);
     TryDo(Color <> 0, 'Error: black team color', true);
 
     // color is always little endian so the mask must be constant also in big endian archs
@@ -562,16 +560,16 @@
 
 procedure chSetHHCoords(var x: shortstring);
 var y: shortstring;
-    t, c: Longint;
+    t: Longint;
 begin
-y:= '';
-if (not isDeveloperMode) or (CurrentHedgehog = nil) or (CurrentHedgehog^.Gear = nil) then
-    exit;
-SplitBySpace(x, y);
-val(x, t, c);
-CurrentHedgehog^.Gear^.X:= int2hwFloat(t);
-val(y, t, c);
-CurrentHedgehog^.Gear^.Y:= int2hwFloat(t)
+    y:= '';
+    if (not isDeveloperMode) or (CurrentHedgehog = nil) or (CurrentHedgehog^.Gear = nil) then
+        exit;
+    SplitBySpace(x, y);
+    t:= StrToInt(x);
+    CurrentHedgehog^.Gear^.X:= int2hwFloat(t);
+    t:= StrToInt(y);
+    CurrentHedgehog^.Gear^.Y:= int2hwFloat(t)
 end;
 
 procedure chBind(var id: shortstring);