hedgewars/uUtils.pas
changeset 11770 68f26b6a3a7d
parent 11743 eefa04b23c3b
child 11775 ee85798d6974
equal deleted inserted replaced
11769:8b17caab10ec 11770:68f26b6a3a7d
    68 function  CheckNoTeamOrHH: boolean; inline;
    68 function  CheckNoTeamOrHH: boolean; inline;
    69 
    69 
    70 function  GetLaunchX(at: TAmmoType; dir: LongInt; angle: LongInt): LongInt;
    70 function  GetLaunchX(at: TAmmoType; dir: LongInt; angle: LongInt): LongInt;
    71 function  GetLaunchY(at: TAmmoType; angle: LongInt): LongInt;
    71 function  GetLaunchY(at: TAmmoType; angle: LongInt): LongInt;
    72 
    72 
       
    73 function read1stLn(filePath: shortstring): shortstring;
       
    74 
    73 {$IFNDEF PAS2C}
    75 {$IFNDEF PAS2C}
    74 procedure Write(var f: textfile; s: shortstring);
    76 procedure Write(var f: textfile; s: shortstring);
    75 procedure WriteLn(var f: textfile; s: shortstring);
    77 procedure WriteLn(var f: textfile; s: shortstring);
    76 function StrLength(s: PChar): Longword;
    78 function StrLength(s: PChar): Longword;
    77 procedure SetLengthA(var s: ansistring; len: Longword);
    79 procedure SetLengthA(var s: ansistring; len: Longword);
    93 procedure initModule(isNotPreview: boolean);
    95 procedure initModule(isNotPreview: boolean);
    94 procedure freeModule;
    96 procedure freeModule;
    95 
    97 
    96 
    98 
    97 implementation
    99 implementation
    98 uses {$IFNDEF PAS2C}typinfo, {$ENDIF}Math, uConsts, uVariables, SysUtils, uPhysFSLayer;
   100 uses {$IFNDEF PAS2C}typinfo, {$ENDIF}Math, uConsts, uVariables, SysUtils, uPhysFSLayer, uDebug;
    99 
   101 
   100 {$IFDEF DEBUGFILE}
   102 {$IFDEF DEBUGFILE}
   101 var logFile: PFSFile;
   103 var logFile: PFSFile;
   102 {$IFDEF USE_VIDEO_RECORDING}
   104 {$IFDEF USE_VIDEO_RECORDING}
   103     logMutex: TRTLCriticalSection; // mutex for debug file
   105     logMutex: TRTLCriticalSection; // mutex for debug file
   509         end;
   511         end;
   510 
   512 
   511     sanitizeCharForLog:= r
   513     sanitizeCharForLog:= r
   512 end;
   514 end;
   513 
   515 
       
   516 function read1stLn(filePath: shortstring): shortstring;
       
   517 var f: pfsFile;
       
   518 begin
       
   519     read1stLn:= '';
       
   520     if pfsExists(filePath) then
       
   521         begin
       
   522         f:= pfsOpenRead(filePath);
       
   523         if (not pfsEOF(f)) and allOK then
       
   524             pfsReadLn(f, read1stLn);
       
   525         pfsClose(f);
       
   526         f:= nil;
       
   527         end;
       
   528 end;
       
   529 
   514 procedure initModule(isNotPreview: boolean);
   530 procedure initModule(isNotPreview: boolean);
   515 {$IFDEF DEBUGFILE}
   531 {$IFDEF DEBUGFILE}
   516 var logfileBase: shortstring;
   532 var logfileBase: shortstring;
   517     i: LongInt;
   533     i: LongInt;
   518 {$ENDIF}
   534 {$ENDIF}