hedgewars/uUtils.pas
changeset 7896 67217e6108fd
parent 7565 00568d3054d0
child 8026 4a4f21070479
child 8095 df61e150eb70
equal deleted inserted replaced
7894:1e8e9400e9de 7896:67217e6108fd
    71 {$IFNDEF PAS2C}
    71 {$IFNDEF PAS2C}
    72 procedure Write(var f: textfile; s: shortstring);
    72 procedure Write(var f: textfile; s: shortstring);
    73 procedure WriteLn(var f: textfile; s: shortstring);
    73 procedure WriteLn(var f: textfile; s: shortstring);
    74 {$ENDIF}
    74 {$ENDIF}
    75 
    75 
    76 procedure initModule(isGame: boolean);
    76 procedure initModule(isNotPreview: boolean);
    77 procedure freeModule;
    77 procedure freeModule;
    78 
    78 
    79 
    79 
    80 implementation
    80 implementation
    81 uses {$IFNDEF PAS2C}typinfo, {$ENDIF}Math, uConsts, uVariables, SysUtils;
    81 uses {$IFNDEF PAS2C}typinfo, {$ENDIF}Math, uConsts, uVariables, SysUtils;
   399 begin
   399 begin
   400 system.writeln(f, s)
   400 system.writeln(f, s)
   401 end;
   401 end;
   402 {$ENDIF}
   402 {$ENDIF}
   403 
   403 
   404 procedure initModule(isGame: boolean);
   404 procedure initModule(isNotPreview: boolean);
   405 {$IFDEF DEBUGFILE}
   405 {$IFDEF DEBUGFILE}
   406 var logfileBase: shortstring;
   406 var logfileBase: shortstring;
   407 {$IFNDEF MOBILE}var i: LongInt;{$ENDIF}
   407 {$IFNDEF MOBILE}var i: LongInt;{$ENDIF}
   408 {$ENDIF}
   408 {$ENDIF}
   409 begin
   409 begin
   410 {$IFDEF DEBUGFILE}
   410 {$IFDEF DEBUGFILE}
   411     if isGame then
   411     if isNotPreview then
   412     begin
   412     begin
   413         if GameType = gmtRecord then
   413         if GameType = gmtRecord then
   414             logfileBase:= 'rec'
   414             logfileBase:= 'rec'
   415         else
   415         else
   416             logfileBase:= 'game';
   416             logfileBase:= 'game';
   420 {$IFDEF USE_VIDEO_RECORDING}
   420 {$IFDEF USE_VIDEO_RECORDING}
   421     InitCriticalSection(logMutex);
   421     InitCriticalSection(logMutex);
   422 {$ENDIF}
   422 {$ENDIF}
   423 {$I-}
   423 {$I-}
   424 {$IFDEF MOBILE}
   424 {$IFDEF MOBILE}
   425     {$IFDEF IPHONEOS} Assign(f,'../Documents/hw-' + logfileBase + '.log'); {$ENDIF}
   425     {$IFDEF IPHONEOS} Assign(f, UserPathPrefix + '/hw-' + logfileBase + '.log'); {$ENDIF}
   426     {$IFDEF ANDROID} Assign(f,pathPrefix + '/' + logfileBase + '.log'); {$ENDIF}
   426     {$IFDEF ANDROID} Assign(f,pathPrefix + '/' + logfileBase + '.log'); {$ENDIF}
   427     Rewrite(f);
   427     Rewrite(f);
   428 {$ELSE}
   428 {$ELSE}
   429     if (UserPathPrefix <> '') then
   429     if (UserPathPrefix <> '') then
   430         begin
   430         begin
   448 
   448 
   449 end;
   449 end;
   450 
   450 
   451 procedure freeModule;
   451 procedure freeModule;
   452 begin
   452 begin
   453 recordFileName:= '';
       
   454 
       
   455 {$IFDEF DEBUGFILE}
   453 {$IFDEF DEBUGFILE}
   456     writeln(f, 'halt at ' + inttostr(GameTicks) + ' ticks. TurnTimeLeft = ' + inttostr(TurnTimeLeft));
   454     writeln(f, 'halt at ' + inttostr(GameTicks) + ' ticks. TurnTimeLeft = ' + inttostr(TurnTimeLeft));
   457     flush(f);
   455     flush(f);
   458     close(f);
   456     close(f);
   459 {$IFDEF USE_VIDEO_RECORDING}
   457 {$IFDEF USE_VIDEO_RECORDING}