hedgewars/uUtils.pas
changeset 13879 6b2c87490f0a
parent 13877 8c702a4839ec
child 13980 3183c4dc6e53
equal deleted inserted replaced
13878:0ce8aad17c24 13879:6b2c87490f0a
    48 function  MinD(a, b: double) : double; inline;
    48 function  MinD(a, b: double) : double; inline;
    49 function  Max(a, b: LongInt): LongInt; inline;
    49 function  Max(a, b: LongInt): LongInt; inline;
    50 
    50 
    51 function  IntToStr(n: LongInt): shortstring;
    51 function  IntToStr(n: LongInt): shortstring;
    52 function  StrToInt(s: shortstring): LongInt;
    52 function  StrToInt(s: shortstring): LongInt;
    53 function  StrToInt(s: shortstring; var success: boolean): LongInt;
    53 //function  StrToInt(s: shortstring; var success: boolean): LongInt;
    54 function  FloatToStr(n: hwFloat): shortstring;
    54 function  FloatToStr(n: hwFloat): shortstring;
    55 
    55 
    56 function  DxDy2Angle(const _dY, _dX: hwFloat): real; inline;
    56 function  DxDy2Angle(const _dY, _dX: hwFloat): real; inline;
    57 function  DxDy2Angle32(const _dY, _dX: hwFloat): LongInt;
    57 function  DxDy2Angle32(const _dY, _dX: hwFloat): LongInt;
    58 function  DxDy2AttackAngle(const _dY, _dX: hwFloat): LongInt;
    58 function  DxDy2AttackAngle(const _dY, _dX: hwFloat): LongInt;
   333 end;
   333 end;
   334 
   334 
   335 // Convert string to longint, with error checking.
   335 // Convert string to longint, with error checking.
   336 // Success will be set to false when conversion failed.
   336 // Success will be set to false when conversion failed.
   337 // See documentation on Val procedure for syntax of s
   337 // See documentation on Val procedure for syntax of s
   338 function StrToInt(s: shortstring; var success: boolean): LongInt;
   338 //function StrToInt(s: shortstring; var success: boolean): LongInt;
   339 begin
   339 //var Code: Word;
   340 val(s, StrToInt);
   340 //begin
   341 success:= StrToInt <> nil;
   341 //val(s, StrToInt, Code);
   342 end;
   342 //success:= Code = 0;
       
   343 //end;
   343 
   344 
   344 // Convert string to longint, without error checking
   345 // Convert string to longint, without error checking
   345 function StrToInt(s: shortstring): LongInt;
   346 function StrToInt(s: shortstring): LongInt;
   346 var success: boolean; // ignored
   347 begin
   347 begin
   348 val(s, StrToInt);
   348 success:= true; // avoid compiler hint
       
   349 StrToInt:= StrToInt(s, success);
       
   350 end;
   349 end;
   351 
   350 
   352 function FloatToStr(n: hwFloat): shortstring;
   351 function FloatToStr(n: hwFloat): shortstring;
   353 begin
   352 begin
   354 FloatToStr:= cstr(n) + '_' + inttostr(Lo(n.QWordValue))
   353 FloatToStr:= cstr(n) + '_' + inttostr(Lo(n.QWordValue))