Log duplicate messages in console

As reported by fokkonaut
This commit is contained in:
def 2021-01-28 11:32:38 +01:00
parent f08812b06a
commit 487bd18a39

View file

@ -667,6 +667,8 @@ void CChat::AddLine(int ClientID, int Team, const char *pLine)
if(*p == 0) if(*p == 0)
return; return;
bool IgnoreLine = false;
while(*p) while(*p)
{ {
Highlighted = false; Highlighted = false;
@ -697,7 +699,11 @@ void CChat::AddLine(int ClientID, int Team, const char *pLine)
pCurrentLine->m_Time = time(); pCurrentLine->m_Time = time();
pCurrentLine->m_YOffset[0] = -1.f; pCurrentLine->m_YOffset[0] = -1.f;
pCurrentLine->m_YOffset[1] = -1.f; pCurrentLine->m_YOffset[1] = -1.f;
return; // Can't return here because we still want to log the message to console,
// even if we ignore it in chat. We will set the new line, fill it out
// totally, but then in the end revert back m_CurrentLine after writing
// the message to console.
IgnoreLine = true;
} }
m_CurrentLine = (m_CurrentLine + 1) % MAX_LINES; m_CurrentLine = (m_CurrentLine + 1) % MAX_LINES;
@ -814,6 +820,12 @@ void CChat::AddLine(int ClientID, int Team, const char *pLine)
Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, Team >= 2 ? "whisper" : (pCurrentLine->m_Team ? "teamchat" : "chat"), aBuf, Highlighted); Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, Team >= 2 ? "whisper" : (pCurrentLine->m_Team ? "teamchat" : "chat"), aBuf, Highlighted);
} }
if(IgnoreLine)
{
m_CurrentLine = (m_CurrentLine + MAX_LINES - 1) % MAX_LINES;
return;
}
// play sound // play sound
int64 Now = time(); int64 Now = time();
if(ClientID == -1) if(ClientID == -1)