hedgewars/uMisc.pas
changeset 915 33040b7695c0
parent 883 07a568ba44e0
child 916 1d0022336fbb
equal deleted inserted replaced
914:c2fcafbfc4aa 915:33040b7695c0
    95     AttackBar: LongInt = 0; // 0 - none, 1 - just bar at the right-down corner, 2 - like in WWP
    95     AttackBar: LongInt = 0; // 0 - none, 1 - just bar at the right-down corner, 2 - like in WWP
    96 
    96 
    97 function hwSign(r: hwFloat): LongInt;
    97 function hwSign(r: hwFloat): LongInt;
    98 function Min(a, b: LongInt): LongInt;
    98 function Min(a, b: LongInt): LongInt;
    99 function Max(a, b: LongInt): LongInt;
    99 function Max(a, b: LongInt): LongInt;
   100 function rndSign(num: hwFloat): hwFloat;
       
   101 procedure OutError(Msg: String; isFatalError: boolean);
   100 procedure OutError(Msg: String; isFatalError: boolean);
   102 procedure TryDo(Assert: boolean; Msg: string; isFatal: boolean);
   101 procedure TryDo(Assert: boolean; Msg: string; isFatal: boolean);
   103 procedure SDLTry(Assert: boolean; isFatal: boolean);
   102 procedure SDLTry(Assert: boolean; isFatal: boolean);
   104 function IntToStr(n: LongInt): shortstring;
   103 function IntToStr(n: LongInt): shortstring;
   105 function FloatToStr(n: hwFloat): shortstring;
   104 function FloatToStr(n: hwFloat): shortstring;
   237 const stc: array [TStatInfoType] of char = 'rDkK';
   236 const stc: array [TStatInfoType] of char = 'rDkK';
   238 begin
   237 begin
   239 SendIPC('i' + stc[sit] + s)
   238 SendIPC('i' + stc[sit] + s)
   240 end;
   239 end;
   241 
   240 
   242 function rndSign(num: hwFloat): hwFloat;
       
   243 begin
       
   244 num.isNegative:= getrandom(2) = 0;
       
   245 rndSign:= num
       
   246 end;
       
   247 
       
   248 function Str2PChar(const s: shortstring): PChar;
   241 function Str2PChar(const s: shortstring): PChar;
   249 const CharArray: array[byte] of Char = '';
   242 const CharArray: array[byte] of Char = '';
   250 begin
   243 begin
   251 CharArray:= s;
   244 CharArray:= s;
   252 CharArray[Length(s)]:= #0;
   245 CharArray[Length(s)]:= #0;
   351     if IOResult = 0 then break
   344     if IOResult = 0 then break
   352     end;
   345     end;
   353 {$I+}
   346 {$I+}
   354 
   347 
   355 finalization
   348 finalization
       
   349 uRandom.DumpBuffer;
   356 writeln(f, '-= halt at ',GameTicks,' ticks =-');
   350 writeln(f, '-= halt at ',GameTicks,' ticks =-');
   357 Flush(f);
   351 Flush(f);
   358 close(f)
   352 close(f)
   359 {$ENDIF}
   353 {$ENDIF}
   360 
   354