# HG changeset patch # User sheepluva # Date 1417271109 -3600 # Node ID c4e86a2efc55a6a39e19023298d8be1857a855c3 # Parent a781c9dc27ec4591be21a8d72af9d208fff61013 give variable with unit-wide scope a better name than just 'f' diff -r a781c9dc27ec -r c4e86a2efc55 hedgewars/uUtils.pas --- a/hedgewars/uUtils.pas Sat Nov 29 14:37:31 2014 +0100 +++ b/hedgewars/uUtils.pas Sat Nov 29 15:25:09 2014 +0100 @@ -96,7 +96,7 @@ uses {$IFNDEF PAS2C}typinfo, {$ENDIF}Math, uConsts, uVariables, SysUtils; {$IFDEF DEBUGFILE} -var f: textfile; +var logFile: textfile; {$IFDEF USE_VIDEO_RECORDING} logMutex: TRTLCriticalSection; // mutex for debug file {$ENDIF} @@ -226,7 +226,7 @@ val(s, StrToInt, c); {$IFDEF DEBUGFILE} if c <> 0 then - writeln(f, 'Error at position ' + IntToStr(c) + ' : ' + s[c]) + writeln(logFile, 'Error at position ' + IntToStr(c) + ' : ' + s[c]) {$ENDIF} {$ENDIF} end; @@ -354,8 +354,8 @@ {$IFDEF USE_VIDEO_RECORDING} EnterCriticalSection(logMutex); {$ENDIF} -writeln(f, inttostr(GameTicks) + ': ' + s); -flush(f); +writeln(logFile, inttostr(GameTicks) + ': ' + s); +flush(logFile); {$IFDEF USE_VIDEO_RECORDING} LeaveCriticalSection(logMutex); @@ -372,8 +372,8 @@ {$IFDEF USE_VIDEO_RECORDING} EnterCriticalSection(logMutex); {$ENDIF} -write(f, s); -flush(f); +write(logFile, s); +flush(logFile); {$IFDEF USE_VIDEO_RECORDING} LeaveCriticalSection(logMutex); {$ENDIF} @@ -539,7 +539,7 @@ {$ENDIF} {$I-} {$IFNDEF PAS2C} - f:= stderr; // if everything fails, write to stderr + logFile:= stderr; // if everything fails, write to stderr {$ENDIF} if (length(UserPathPrefix) > 0) then begin @@ -552,13 +552,13 @@ i:= 0; while(i < 7) do begin - assign(f, shortstring(UserPathPrefix) + '/Logs/' + logfileBase + inttostr(i) + '.log'); + assign(logFile, shortstring(UserPathPrefix) + '/Logs/' + logfileBase + inttostr(i) + '.log'); if IOResult = 0 then break; inc(i) end; end; - Rewrite(f); + Rewrite(logFile); {$I+} {$ENDIF} @@ -580,9 +580,9 @@ procedure freeModule; begin {$IFDEF DEBUGFILE} - writeln(f, 'halt at ' + inttostr(GameTicks) + ' ticks. TurnTimeLeft = ' + inttostr(TurnTimeLeft)); - flush(f); - close(f); + writeln(logFile, 'halt at ' + inttostr(GameTicks) + ' ticks. TurnTimeLeft = ' + inttostr(TurnTimeLeft)); + flush(logFile); + close(logFile); {$IFDEF USE_VIDEO_RECORDING} DoneCriticalSection(logMutex); {$ENDIF}