--- a/hedgewars/uPhysFSLayer.pas Tue May 14 20:58:39 2019 +0200
+++ b/hedgewars/uPhysFSLayer.pas Tue May 14 21:49:01 2019 +0200
@@ -35,6 +35,7 @@
procedure pfsReadLn(f: PFSFile; var s: shortstring);
procedure pfsReadLnA(f: PFSFile; var s: ansistring);
procedure pfsWriteLn(f: PFSFile; s: shortstring);
+procedure pfsWriteRaw(f: PFSFile; s: PChar; len: QWord);
function pfsBlockRead(f: PFSFile; buf: pointer; size: Int64): Int64;
function pfsEOF(f: PFSFile): boolean;
@@ -179,6 +180,11 @@
PHYSFS_writeBytes(f, @c, 1);
end;
+procedure pfsWriteRaw(f: PFSFile; s: PChar; len: QWord);
+begin
+ PHYSFS_writeBytes(f, s, len);
+end;
+
function pfsBlockRead(f: PFSFile; buf: pointer; size: Int64): Int64;
var r: Int64;
begin
--- a/hedgewars/uUtils.pas Tue May 14 20:58:39 2019 +0200
+++ b/hedgewars/uUtils.pas Tue May 14 21:49:01 2019 +0200
@@ -526,6 +526,7 @@
end;
procedure AddFileLogRaw(s: pchar); cdecl;
+var tmp: shortstring;
begin
s:= s;
{$IFNDEF PAS2C}
@@ -534,9 +535,17 @@
if SDL_LockMutex(logMutex) <> 0 then
OutError('Logging mutex could not be locked!', true);
{$ENDIF}
-// TODO: uncomment next two lines
-// write(logFile, s);
-// flush(logFile);
+tmp:= IntToStr(GameTicks) + ': ';
+if (logFile <> nil) then
+ begin
+ pfsWriteRaw(logFile, Str2PChar(tmp), StrLen(Str2PChar(tmp)));
+ pfsWriteRaw(logFile, s, StrLen(s));
+ end
+else
+ begin
+ Write(stdout, Str2PChar(tmp));
+ Flush(stdout);
+ end;
{$IFDEF USE_VIDEO_RECORDING}
if SDL_UnlockMutex(logMutex) <> 0 then
OutError('Logging mutex could not be unlocked!', true);