From aa18c1ee78d56e62067f82d58d95022d85cf44a6 Mon Sep 17 00:00:00 2001 From: Dennis Felsing Date: Thu, 7 Jul 2022 10:24:41 +0200 Subject: [PATCH] Only announce birthday once (fixes #5576) No matter if you use /timecp or rename --- src/game/server/player.cpp | 4 +++- src/game/server/player.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/game/server/player.cpp b/src/game/server/player.cpp index 1c85da395..f2db05d1f 100644 --- a/src/game/server/player.cpp +++ b/src/game/server/player.cpp @@ -145,6 +145,7 @@ void CPlayer::Reset() m_EligibleForFinishCheck = 0; m_VotedForPractice = false; m_SwapTargetsClientID = -1; + m_BirthdayAnnounced = false; } static int PlayerFlags_SixToSeven(int Flags) @@ -887,7 +888,7 @@ void CPlayer::ProcessScoreResult(CScorePlayerResult &Result) m_Score = -10000; Server()->ExpireServerInfo(); int Birthday = Result.m_Data.m_Info.m_Birthday; - if(Birthday != 0) + if(Birthday != 0 && !m_BirthdayAnnounced) { char aBuf[512]; str_format(aBuf, sizeof(aBuf), @@ -898,6 +899,7 @@ void CPlayer::ProcessScoreResult(CScorePlayerResult &Result) "Happy DDNet birthday, %s!\nYou have finished your first map exactly %d year%s ago!", Server()->ClientName(m_ClientID), Birthday, Birthday > 1 ? "s" : ""); GameServer()->SendBroadcast(aBuf, m_ClientID); + m_BirthdayAnnounced = true; } break; } diff --git a/src/game/server/player.h b/src/game/server/player.h index 939d10bcd..62eda8857 100644 --- a/src/game/server/player.h +++ b/src/game/server/player.h @@ -214,6 +214,7 @@ public: int64_t m_EligibleForFinishCheck; bool m_VotedForPractice; int m_SwapTargetsClientID; //Client ID of the swap target for the given player + bool m_BirthdayAnnounced; }; #endif