diff -r c7ee9592c9a1 -r ec15d9e1a7e3 hedgewars/uUtils.pas --- a/hedgewars/uUtils.pas Wed May 30 19:01:19 2012 +0400 +++ b/hedgewars/uUtils.pas Thu May 31 15:14:39 2012 +0400 @@ -39,6 +39,7 @@ function Max(a, b: LongInt): LongInt; inline; function IntToStr(n: LongInt): shortstring; +function StrToInt(s: shortstring): LongInt; function FloatToStr(n: hwFloat): shortstring; function DxDy2Angle(const _dY, _dX: hwFloat): GLfloat; @@ -65,6 +66,11 @@ function GetLaunchX(at: TAmmoType; dir: LongInt; angle: LongInt): LongInt; function GetLaunchY(at: TAmmoType; angle: LongInt): LongInt; +{$IFNDEF PAS2C} +procedure Write(var f: textfile; s: shortstring); +procedure WriteLn(var f: textfile; s: shortstring); +{$ENDIF} + procedure initModule(isGame: boolean); procedure freeModule; @@ -158,6 +164,12 @@ str(n, IntToStr) end; +function StrToInt(s: shortstring): LongInt; +var c: LongInt; +begin +val(s, StrToInt, c) +end; + function FloatToStr(n: hwFloat): shortstring; begin FloatToStr:= cstr(n) + '_' + inttostr(Lo(n.QWordValue)) @@ -285,7 +297,7 @@ begin s:= s; {$IFDEF DEBUGFILE} -writeln(f, GameTicks, ': ', s); +writeln(f, inttostr(GameTicks) + ': ' + s); flush(f) {$ENDIF} end; @@ -359,6 +371,18 @@ CheckNoTeamOrHH:= (CurrentTeam = nil) or (CurrentHedgehog^.Gear = nil); end; +{$IFNDEF PAS2C} +procedure Write(var f: textfile; s: shortstring); +begin +system.write(f, s) +end; + +procedure WriteLn(var f: textfile; s: shortstring); +begin +system.writeln(f, s) +end; +{$ENDIF} + procedure initModule(isGame: boolean); {$IFDEF DEBUGFILE} var logfileBase: shortstring; @@ -403,7 +427,7 @@ recordFileName:= ''; {$IFDEF DEBUGFILE} - writeln(f, 'halt at ', GameTicks, ' ticks. TurnTimeLeft = ', TurnTimeLeft); + writeln(f, 'halt at ' + inttostr(GameTicks) + ' ticks. TurnTimeLeft = ' + inttostr(TurnTimeLeft)); flush(f); close(f); {$ENDIF}