From b2b664bf5371c913369548e1768b2e4704168c1f Mon Sep 17 00:00:00 2001 From: def Date: Tue, 7 Jul 2020 11:57:57 +0200 Subject: [PATCH] Don't reset chat on map change (fixes #2451) --- src/game/client/components/chat.cpp | 13 +++++-------- src/game/client/components/chat.h | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/game/client/components/chat.cpp b/src/game/client/components/chat.cpp index c3c3c16f5..8a5fcf971 100644 --- a/src/game/client/components/chat.cpp +++ b/src/game/client/components/chat.cpp @@ -35,7 +35,7 @@ CChat::CChat() #include m_Commands.sort_range(); - OnReset(); + Reset(); } void CChat::RegisterCommand(const char *pName, const char *pParams, int flags, const char *pHelp) @@ -53,7 +53,7 @@ void CChat::OnWindowResize() } } -void CChat::OnReset() +void CChat::Reset() { for(int i = 0; i < MAX_LINES; i++) { @@ -80,6 +80,8 @@ void CChat::OnReset() m_pHistoryEntry = 0x0; m_PendingChatCounter = 0; m_LastChatSend = 0; + m_CurrentLine = 0; + m_Mode = MODE_NONE; for(int i = 0; i < CHAT_NUM; ++i) m_aLastSoundPlayed[i] = 0; @@ -94,13 +96,8 @@ void CChat::OnStateChange(int NewState, int OldState) { if(OldState <= IClient::STATE_CONNECTING) { - m_Mode = MODE_NONE; + Reset(); Input()->SetIMEState(false); - for(int i = 0; i < MAX_LINES; i++) - { - m_aLines[i].m_Time = 0; - } - m_CurrentLine = 0; } } diff --git a/src/game/client/components/chat.h b/src/game/client/components/chat.h index 13f397459..f41ff8c2a 100644 --- a/src/game/client/components/chat.h +++ b/src/game/client/components/chat.h @@ -92,6 +92,7 @@ class CChat : public CComponent bool LineShouldHighlight(const char *pLine, const char *pName); void StoreSave(const char *pText); + void Reset(); public: CChat(); @@ -105,7 +106,6 @@ public: void Echo(const char *pString); virtual void OnWindowResize(); - virtual void OnReset(); virtual void OnConsoleInit(); virtual void OnStateChange(int NewState, int OldState); virtual void OnRender();