hedgewars/uUtils.pas
changeset 14969 f27f00fabc0d
parent 14967 23fc5022bdea
child 15897 d7b53d08ad9c
equal deleted inserted replaced
14968:414924c06704 14969:f27f00fabc0d
   524 
   524 
   525 {$ENDIF}
   525 {$ENDIF}
   526 end;
   526 end;
   527 
   527 
   528 procedure AddFileLogRaw(s: pchar); cdecl;
   528 procedure AddFileLogRaw(s: pchar); cdecl;
   529 var tmp: shortstring;
   529 var msgLine: PChar;
   530 begin
   530 begin
   531 s:= s;
   531 s:= s;
   532 {$IFNDEF PAS2C}
   532 {$IFNDEF PAS2C}
   533 {$IFDEF DEBUGFILE}
   533 {$IFDEF DEBUGFILE}
   534 {$IFDEF USE_VIDEO_RECORDING}
   534 {$IFDEF USE_VIDEO_RECORDING}
   535 if SDL_LockMutex(logMutex) <> 0 then
   535 if SDL_LockMutex(logMutex) <> 0 then
   536     OutError('Logging mutex could not be locked!', true);
   536     OutError('Logging mutex could not be locked!', true);
   537 {$ENDIF}
   537 {$ENDIF}
   538 tmp:= IntToStr(GameTicks) + ': ';
   538 msgLine:= Str2PChar(IntToStr(GameTicks) + ': ');
   539 if (logFile <> nil) then
   539 if (logFile <> nil) then
   540     begin
   540     begin
   541     pfsWriteRaw(logFile, Str2PChar(tmp), StrLen(Str2PChar(tmp)));
   541     pfsWriteRaw(logFile, msgLine, StrLen(msgLine));
   542     pfsWriteRaw(logFile, s, StrLen(s));
   542     pfsWriteRaw(logFile, s, StrLen(s));
   543     end
   543     end
   544 else
   544 else
   545     begin
   545     begin
   546     Write(stdout, Str2PChar(tmp));
   546     Write(stdout, msgLine);
   547     Flush(stdout);
   547     Flush(stdout);
   548     end;
   548     end;
   549 {$IFDEF USE_VIDEO_RECORDING}
   549 {$IFDEF USE_VIDEO_RECORDING}
   550 if SDL_UnlockMutex(logMutex) <> 0 then
   550 if SDL_UnlockMutex(logMutex) <> 0 then
   551     OutError('Logging mutex could not be unlocked!', true);
   551     OutError('Logging mutex could not be unlocked!', true);