1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 06:23:53 +00:00

Merge branch 'i-know-what-time-it-is' into 'master'

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

Closes #6982

See merge request OpenMW/openmw!3593
This commit is contained in:
Zackhasacat 2023-11-21 03:00:36 +00:00
commit f3770a2364

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);
addShieldedStr(prefix); if (!hasPrefix)
{
addShieldedStr(prefix);
hasPrefix = true;
}
addShieldedStr(msg); addShieldedStr(msg);
if (bufferOverflow) if (bufferOverflow)
sLogStartIndex = (sLogEndIndex + 1) % bufSize; sLogStartIndex = (sLogEndIndex + 1) % bufSize;