From 939b45a0aafe657f914f9c069199cddf1b5bac2a Mon Sep 17 00:00:00 2001 From: Learath Date: Fri, 12 Jun 2020 16:25:58 +0300 Subject: [PATCH] Actually remove duplicate message --- src/game/server/gamecontext.cpp | 13 ++++--------- src/game/server/gamecontext.h | 7 +++++-- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp index 5cedf6708..a15d036a5 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -350,7 +350,7 @@ void CGameContext::SendChatTeam(int Team, const char *pText) SendChatTarget(i, pText); } -void CGameContext::SendChat(int ChatterClientID, int Team, const char *pText, int SpamProtectionClientID) +void CGameContext::SendChat(int ChatterClientID, int Team, const char *pText, int SpamProtectionClientID, int Flags) { if(SpamProtectionClientID >= 0 && SpamProtectionClientID < MAX_CLIENTS) if(ProcessSpamProtection(SpamProtectionClientID)) @@ -384,10 +384,8 @@ void CGameContext::SendChat(int ChatterClientID, int Team, const char *pText, in // send to the clients for(int i = 0; i < MAX_CLIENTS; i++) { - if(m_apPlayers[i] != 0) { - if(!m_apPlayers[i]->m_DND) + if(m_apPlayers[i] != 0 && !m_apPlayers[i]->m_DND && Server()->IsSixup(i) == (Flags & CHAT_SIXUP)) Server()->SendPackMsg(&Msg, MSGFLAG_VITAL|MSGFLAG_NORECORD, i); - } } } else @@ -1086,11 +1084,8 @@ void CGameContext::OnClientEnter(int ClientID) } char aBuf[512]; - if(!Server()->IsSixup(ClientID)) - { - str_format(aBuf, sizeof(aBuf), "'%s' entered and joined the %s", Server()->ClientName(ClientID), m_pController->GetTeamName(m_apPlayers[ClientID]->GetTeam())); - SendChat(-1, CGameContext::CHAT_ALL, aBuf); - } + str_format(aBuf, sizeof(aBuf), "'%s' entered and joined the %s", Server()->ClientName(ClientID), m_pController->GetTeamName(m_apPlayers[ClientID]->GetTeam())); + SendChat(-1, CGameContext::CHAT_ALL, aBuf, -1, CHAT_SIX); SendChatTarget(ClientID, "DDraceNetwork Mod. Version: " GAME_VERSION); SendChatTarget(ClientID, "please visit DDNet.tw or say /info for more info"); diff --git a/src/game/server/gamecontext.h b/src/game/server/gamecontext.h index fea87a77b..b0e569d91 100644 --- a/src/game/server/gamecontext.h +++ b/src/game/server/gamecontext.h @@ -191,14 +191,17 @@ public: CHAT_RED=0, CHAT_BLUE=1, CHAT_WHISPER_SEND=2, - CHAT_WHISPER_RECV=3 + CHAT_WHISPER_RECV=3, + + CHAT_SIX=1<<0, + CHAT_SIXUP=1<<1, }; // network void CallVote(int ClientID, const char *aDesc, const char *aCmd, const char *pReason, const char *aChatmsg); void SendChatTarget(int To, const char *pText); void SendChatTeam(int Team, const char *pText); - void SendChat(int ClientID, int Team, const char *pText, int SpamProtectionClientID = -1); + void SendChat(int ClientID, int Team, const char *pText, int SpamProtectionClientID = -1, int Flags = CHAT_SIX | CHAT_SIXUP); void SendEmoticon(int ClientID, int Emoticon); void SendWeaponPickup(int ClientID, int Weapon); void SendBroadcast(const char *pText, int ClientID, bool IsImportant = true);