From b642f519c10d5b18a37fbfdaaaf14f3c70c51e41 Mon Sep 17 00:00:00 2001 From: srdante Date: Tue, 29 Mar 2022 17:35:50 -0300 Subject: [PATCH] Fix whisper sending/receiving differentiation --- src/game/client/components/chat.cpp | 13 +++++++------ src/game/client/components/chat.h | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/game/client/components/chat.cpp b/src/game/client/components/chat.cpp index b5c02ef0a..3c7811071 100644 --- a/src/game/client/components/chat.cpp +++ b/src/game/client/components/chat.cpp @@ -686,9 +686,6 @@ void CChat::AddLine(int ClientID, int Team, const char *pLine) bool Highlighted = false; char *p = const_cast(pLine); - bool IsTeamLine = Team == 1; - bool IsWhisperLine = Team >= 2; - // Only empty string left if(*p == 0) return; @@ -741,8 +738,11 @@ void CChat::AddLine(int ClientID, int Team, const char *pLine) CLine *pCurrentLine = &m_aLines[m_CurrentLine]; + // Team Number: + // 0 = global; 1 = team; 2 = sending whisper; 3 = receiving whisper + // If it's a client message, m_aText will have ": " prepended so we have to work around it. - if(pCurrentLine->m_Team == IsTeamLine && pCurrentLine->m_Whisper == IsWhisperLine && pCurrentLine->m_ClientID == ClientID && str_comp(pCurrentLine->m_aText, pLine) == 0) + if(pCurrentLine->m_TeamNumber == Team && pCurrentLine->m_ClientID == ClientID && str_comp(pCurrentLine->m_aText, pLine) == 0) { pCurrentLine->m_TimesRepeated++; if(pCurrentLine->m_TextContainerIndex != -1) @@ -768,8 +768,9 @@ void CChat::AddLine(int ClientID, int Team, const char *pLine) pCurrentLine->m_YOffset[0] = -1.0f; pCurrentLine->m_YOffset[1] = -1.0f; pCurrentLine->m_ClientID = ClientID; - pCurrentLine->m_Team = IsTeamLine; - pCurrentLine->m_Whisper = IsWhisperLine; + pCurrentLine->m_TeamNumber = Team; + pCurrentLine->m_Team = Team == 1; + pCurrentLine->m_Whisper = Team >= 2; pCurrentLine->m_NameColor = -2; if(pCurrentLine->m_TextContainerIndex != -1) diff --git a/src/game/client/components/chat.h b/src/game/client/components/chat.h index 87df221b9..34a3e5dbc 100644 --- a/src/game/client/components/chat.h +++ b/src/game/client/components/chat.h @@ -27,6 +27,7 @@ class CChat : public CComponent int64_t m_Time; float m_YOffset[2]; int m_ClientID; + int m_TeamNumber; bool m_Team; bool m_Whisper; int m_NameColor;