X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fengine%2Fe_log.pas;h=a1ca45c21e6da75c2948a2a4c99a32b5dc66103d;hb=1584838149790971c32aafc50a7e72506de814a1;hp=e2a88e08b66305dfebdc895eab2bfc17a40c9cdf;hpb=281b90361877a19420b086d8729eb4b6aaf882fa;p=d2df-sdl.git diff --git a/src/engine/e_log.pas b/src/engine/e_log.pas index e2a88e0..a1ca45c 100644 --- a/src/engine/e_log.pas +++ b/src/engine/e_log.pas @@ -40,7 +40,7 @@ function DecodeIPV4 (ip: LongWord): string; // start Write/WriteLn driver. it will write everything to cbuf. procedure e_InitWritelnDriver (); -procedure e_LogWritefln (const fmt: AnsiString; args: array of const; category: TMsgType=TMsgType.Notify; writeTime: Boolean=true); +procedure e_LogWritefln (const fmt: AnsiString; args: array of const; category: TMsgType=TMsgType.Notify; writeTime: Boolean=true; writeConsole: Boolean=true); procedure e_LogWriteln (const s: AnsiString; category: TMsgType=TMsgType.Notify; writeTime: Boolean=true); @@ -54,7 +54,10 @@ var implementation uses - SDL2, conbuf, utils; + {$IFDEF ANDROID} + SDL2, + {$ENDIF} + conbuf, utils; var FirstRecord: Boolean; @@ -68,15 +71,24 @@ begin end; +function consoleAllow (const s: String): Boolean; +begin + Result := False; + if Pos('[Chat] ', s) = 1 then + Exit; + Result := True; +end; + + procedure e_WriteLog (TextLine: String; RecordCategory: TMsgType; WriteTime: Boolean=True); begin - e_LogWritefln('%s', [TextLine], RecordCategory, WriteTime); + e_LogWritefln('%s', [TextLine], RecordCategory, WriteTime, consoleAllow(TextLine)); end; procedure e_LogWriteln (const s: AnsiString; category: TMsgType=TMsgType.Notify; writeTime: Boolean=true); begin - e_LogWritefln('%s', [s], category, writeTime); + e_LogWritefln('%s', [s], category, writeTime, consoleAllow(s)); end; @@ -99,8 +111,8 @@ begin {$IFDEF ANDROID} cstr := GetMem(len + 1); for slen := 0 to len - 1 do - cstr[slen] := Char(b[slen]); - cstr[slen + 1] := #0; + cstr[slen] := Chr(b[slen]); + cstr[len] := #0; SDL_Log(cstr, []); Dispose(cstr); {$ENDIF} @@ -180,7 +192,7 @@ begin end; -procedure e_LogWritefln (const fmt: AnsiString; args: array of const; category: TMsgType=TMsgType.Notify; writeTime: Boolean=true); +procedure e_LogWritefln (const fmt: AnsiString; args: array of const; category: TMsgType=TMsgType.Notify; writeTime: Boolean=true; writeConsole: Boolean=true); procedure xwrite (const s: AnsiString); begin @@ -189,7 +201,7 @@ procedure e_LogWritefln (const fmt: AnsiString; args: array of const; category: end; begin - if driverInited and (length(fmt) > 0) then + if driverInited and (length(fmt) > 0) and writeConsole then begin case category of TMsgType.Fatal: write('FATAL: ');