1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-31 11:36:40 +00:00

Fix(Log): Don't Put Timestamps Mid-Message

This commit is contained in:
Dave Corley 2023-11-21 03:00:36 +00:00 committed by Zackhasacat
parent 5a1a54b959
commit 5cc1b117ea

View file

@ -129,6 +129,7 @@ namespace MWGui
static std::mutex sBufferMutex; static std::mutex sBufferMutex;
static int64_t sLogStartIndex; static int64_t sLogStartIndex;
static int64_t sLogEndIndex; static int64_t sLogEndIndex;
static bool hasPrefix = false;
void DebugWindow::startLogRecording() void DebugWindow::startLogRecording()
{ {
@ -170,11 +171,17 @@ namespace MWGui
addChar(c); addChar(c);
if (c == '#') if (c == '#')
addChar(c); addChar(c);
if (c == '\n')
hasPrefix = false;
} }
}; };
for (char c : color) for (char c : color)
addChar(c); addChar(c);
if (!hasPrefix)
{
addShieldedStr(prefix); addShieldedStr(prefix);
hasPrefix = true;
}
addShieldedStr(msg); addShieldedStr(msg);
if (bufferOverflow) if (bufferOverflow)
sLogStartIndex = (sLogEndIndex + 1) % bufSize; sLogStartIndex = (sLogEndIndex + 1) % bufSize;