hedgewars/uUtils.pas
changeset 7198 5debd5fe526e
parent 7194 d8e68cbca7ee
child 7386 e82a076df09b
--- a/hedgewars/uUtils.pas	Fri Jun 08 02:41:14 2012 +0400
+++ b/hedgewars/uUtils.pas	Fri Jun 08 02:52:35 2012 +0400
@@ -82,8 +82,10 @@
 
 {$IFDEF DEBUGFILE}
 var f: textfile;
+{$IFDEF USE_VIDEO_RECORDING}
     logMutex: TRTLCriticalSection; // mutex for debug file
 {$ENDIF}
+{$ENDIF}
 var CharArray: array[byte] of Char;
 
 procedure SplitBySpace(var a,b: shortstring);
@@ -305,22 +307,30 @@
 begin
 s:= s;
 {$IFDEF DEBUGFILE}
+{$IFDEF USE_VIDEO_RECORDING}
 EnterCriticalSection(logMutex);
+{$ENDIF}
 writeln(f, inttostr(GameTicks)  + ': ' + s);
 flush(f);
+{$IFDEF USE_VIDEO_RECORDING}
 LeaveCriticalSection(logMutex);
 {$ENDIF}
+{$ENDIF}
 end;
 
 procedure AddFileLogRaw(s: pchar); cdecl;
 begin
 s:= s;
 {$IFDEF DEBUGFILE}
+{$IFDEF USE_VIDEO_RECORDING}
 EnterCriticalSection(logMutex);
+{$ENDIF}
 write(f, s);
 flush(f);
+{$IFDEF USE_VIDEO_RECORDING}
 LeaveCriticalSection(logMutex);
 {$ENDIF}
+{$ENDIF}
 end;
 
 function CheckCJKFont(s: ansistring; font: THWFont): THWFont;
@@ -414,7 +424,9 @@
         logfileBase:= 'game'
     else
         logfileBase:= 'preview';
+{$IFDEF USE_VIDEO_RECORDING}
     InitCriticalSection(logMutex);
+{$ENDIF}
 {$I-}
 {$IFDEF MOBILE}
     {$IFDEF IPHONEOS} Assign(f,'../Documents/hw-' + logfileBase + '.log'); {$ENDIF}
@@ -451,8 +463,10 @@
     writeln(f, 'halt at ' + inttostr(GameTicks) + ' ticks. TurnTimeLeft = ' + inttostr(TurnTimeLeft));
     flush(f);
     close(f);
+{$IFDEF USE_VIDEO_RECORDING}
     DoneCriticalSection(logMutex);
 {$ENDIF}
+{$ENDIF}
 end;
 
 end.