Only announce birthday once (fixes #5576)

No matter if you use /timecp or rename
This commit is contained in:
Dennis Felsing 2022-07-07 10:24:41 +02:00
parent e257a9ace1
commit aa18c1ee78
2 changed files with 4 additions and 1 deletions

View file

@ -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;
}

View file

@ -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