Rename CHAT_SIX/SEVEN to more generic FLAG_SIX/SEVEN

This commit is contained in:
ChillerDragon 2024-08-21 21:33:34 +08:00
parent 54271aef2a
commit 00b9eab2ce
5 changed files with 26 additions and 26 deletions

View file

@ -546,7 +546,7 @@ void CGameContext::CallVote(int ClientId, const char *pDesc, const char *pCmd, c
if(!pPlayer)
return;
SendChat(-1, TEAM_ALL, pChatmsg, -1, CHAT_SIX);
SendChat(-1, TEAM_ALL, pChatmsg, -1, FLAG_SIX);
if(!pSixupDesc)
pSixupDesc = pDesc;
@ -557,7 +557,7 @@ void CGameContext::CallVote(int ClientId, const char *pDesc, const char *pCmd, c
pPlayer->m_LastVoteCall = Now;
}
void CGameContext::SendChatTarget(int To, const char *pText, int Flags) const
void CGameContext::SendChatTarget(int To, const char *pText, int VersionFlags) const
{
CNetMsg_Sv_Chat Msg;
Msg.m_Team = 0;
@ -571,8 +571,8 @@ void CGameContext::SendChatTarget(int To, const char *pText, int Flags) const
{
for(int i = 0; i < Server()->MaxClients(); i++)
{
if(!((Server()->IsSixup(i) && (Flags & CHAT_SIXUP)) ||
(!Server()->IsSixup(i) && (Flags & CHAT_SIX))))
if(!((Server()->IsSixup(i) && (VersionFlags & FLAG_SIXUP)) ||
(!Server()->IsSixup(i) && (VersionFlags & FLAG_SIX))))
continue;
Server()->SendPackMsg(&Msg, MSGFLAG_VITAL | MSGFLAG_NORECORD, i);
@ -580,8 +580,8 @@ void CGameContext::SendChatTarget(int To, const char *pText, int Flags) const
}
else
{
if(!((Server()->IsSixup(To) && (Flags & CHAT_SIXUP)) ||
(!Server()->IsSixup(To) && (Flags & CHAT_SIX))))
if(!((Server()->IsSixup(To) && (VersionFlags & FLAG_SIXUP)) ||
(!Server()->IsSixup(To) && (VersionFlags & FLAG_SIX))))
return;
Server()->SendPackMsg(&Msg, MSGFLAG_VITAL | MSGFLAG_NORECORD, To);
@ -595,7 +595,7 @@ void CGameContext::SendChatTeam(int Team, const char *pText) const
SendChatTarget(i, pText);
}
void CGameContext::SendChat(int ChatterClientId, int Team, const char *pText, int SpamProtectionClientId, int Flags)
void CGameContext::SendChat(int ChatterClientId, int Team, const char *pText, int SpamProtectionClientId, int VersionFlags)
{
if(SpamProtectionClientId >= 0 && SpamProtectionClientId < MAX_CLIENTS)
if(ProcessSpamProtection(SpamProtectionClientId))
@ -631,8 +631,8 @@ void CGameContext::SendChat(int ChatterClientId, int Team, const char *pText, in
{
if(!m_apPlayers[i])
continue;
bool Send = (Server()->IsSixup(i) && (Flags & CHAT_SIXUP)) ||
(!Server()->IsSixup(i) && (Flags & CHAT_SIX));
bool Send = (Server()->IsSixup(i) && (VersionFlags & FLAG_SIXUP)) ||
(!Server()->IsSixup(i) && (VersionFlags & FLAG_SIX));
if(!m_apPlayers[i]->m_DND && Send)
Server()->SendPackMsg(&Msg, MSGFLAG_VITAL | MSGFLAG_NORECORD, i);
@ -1181,7 +1181,7 @@ void CGameContext::OnTick()
Console()->ExecuteLine(m_aVoteCommand);
Server()->SetRconCid(IServer::RCON_CID_SERV);
EndVote();
SendChat(-1, TEAM_ALL, "Vote passed", -1, CHAT_SIX);
SendChat(-1, TEAM_ALL, "Vote passed", -1, FLAG_SIX);
if(m_apPlayers[m_VoteCreator] && !IsKickVote() && !IsSpecVote())
m_apPlayers[m_VoteCreator]->m_LastVoteCall = 0;
@ -1189,22 +1189,22 @@ void CGameContext::OnTick()
else if(m_VoteEnforce == VOTE_ENFORCE_YES_ADMIN)
{
Console()->ExecuteLine(m_aVoteCommand, m_VoteEnforcer);
SendChat(-1, TEAM_ALL, "Vote passed enforced by authorized player", -1, CHAT_SIX);
SendChat(-1, TEAM_ALL, "Vote passed enforced by authorized player", -1, FLAG_SIX);
EndVote();
}
else if(m_VoteEnforce == VOTE_ENFORCE_NO_ADMIN)
{
EndVote();
SendChat(-1, TEAM_ALL, "Vote failed enforced by authorized player", -1, CHAT_SIX);
SendChat(-1, TEAM_ALL, "Vote failed enforced by authorized player", -1, FLAG_SIX);
}
//else if(m_VoteEnforce == VOTE_ENFORCE_NO || time_get() > m_VoteCloseTime)
else if(m_VoteEnforce == VOTE_ENFORCE_NO || (time_get() > m_VoteCloseTime && g_Config.m_SvVoteMajority))
{
EndVote();
if(VetoStop || (m_VoteWillPass && Veto))
SendChat(-1, TEAM_ALL, "Vote failed because of veto. Find an empty server instead", -1, CHAT_SIX);
SendChat(-1, TEAM_ALL, "Vote failed because of veto. Find an empty server instead", -1, FLAG_SIX);
else
SendChat(-1, TEAM_ALL, "Vote failed", -1, CHAT_SIX);
SendChat(-1, TEAM_ALL, "Vote failed", -1, FLAG_SIX);
}
else if(m_VoteUpdate)
{
@ -3345,7 +3345,7 @@ void CGameContext::ConForceVote(IConsole::IResult *pResult, void *pUserData)
if(str_comp_nocase(pValue, pOption->m_aDescription) == 0)
{
str_format(aBuf, sizeof(aBuf), "authorized player forced server option '%s' (%s)", pValue, pReason);
pSelf->SendChatTarget(-1, aBuf, CHAT_SIX);
pSelf->SendChatTarget(-1, aBuf, FLAG_SIX);
pSelf->Console()->ExecuteLine(pOption->m_aCommand);
break;
}

View file

@ -250,15 +250,15 @@ public:
enum
{
CHAT_SIX = 1 << 0,
CHAT_SIXUP = 1 << 1,
FLAG_SIX = 1 << 0,
FLAG_SIXUP = 1 << 1,
};
// network
void CallVote(int ClientId, const char *pDesc, const char *pCmd, const char *pReason, const char *pChatmsg, const char *pSixupDesc = 0);
void SendChatTarget(int To, const char *pText, int Flags = CHAT_SIX | CHAT_SIXUP) const;
void SendChatTarget(int To, const char *pText, int VersionFlags = FLAG_SIX | FLAG_SIXUP) const;
void SendChatTeam(int Team, const char *pText) const;
void SendChat(int ClientId, int Team, const char *pText, int SpamProtectionClientId = -1, int Flags = CHAT_SIX | CHAT_SIXUP);
void SendChat(int ClientId, int Team, const char *pText, int SpamProtectionClientId = -1, int VersionFlags = FLAG_SIX | FLAG_SIXUP);
void SendStartWarning(int ClientId, const char *pMessage);
void SendEmoticon(int ClientId, int Emoticon, int TargetClientId) const;
void SendWeaponPickup(int ClientId, int Weapon) const;

View file

@ -410,7 +410,7 @@ void IGameController::OnPlayerDisconnect(class CPlayer *pPlayer, const char *pRe
str_format(aBuf, sizeof(aBuf), "'%s' has left the game (%s)", Server()->ClientName(ClientId), pReason);
else
str_format(aBuf, sizeof(aBuf), "'%s' has left the game", Server()->ClientName(ClientId));
GameServer()->SendChat(-1, TEAM_ALL, aBuf, -1, CGameContext::CHAT_SIX);
GameServer()->SendChat(-1, TEAM_ALL, aBuf, -1, CGameContext::FLAG_SIX);
str_format(aBuf, sizeof(aBuf), "leave player='%d:%s'", ClientId, Server()->ClientName(ClientId));
GameServer()->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "game", aBuf);

View file

@ -127,7 +127,7 @@ void CGameControllerDDRace::OnPlayerConnect(CPlayer *pPlayer)
{
char aBuf[512];
str_format(aBuf, sizeof(aBuf), "'%s' entered and joined the %s", Server()->ClientName(ClientId), GetTeamName(pPlayer->GetTeam()));
GameServer()->SendChat(-1, TEAM_ALL, aBuf, -1, CGameContext::CHAT_SIX);
GameServer()->SendChat(-1, TEAM_ALL, aBuf, -1, CGameContext::FLAG_SIX);
GameServer()->SendChatTarget(ClientId, "DDraceNetwork Mod. Version: " GAME_VERSION);
GameServer()->SendChatTarget(ClientId, "please visit DDNet.org or say /info and make sure to read our /rules");

View file

@ -711,9 +711,9 @@ void CGameTeams::OnFinish(CPlayer *Player, int TimeTicks, const char *pTimestamp
Server()->ClientName(ClientId), (int)Time / 60,
Time - ((int)Time / 60 * 60));
if(g_Config.m_SvHideScore || !g_Config.m_SvSaveWorseScores)
GameServer()->SendChatTarget(ClientId, aBuf, CGameContext::CHAT_SIX);
GameServer()->SendChatTarget(ClientId, aBuf, CGameContext::FLAG_SIX);
else
GameServer()->SendChat(-1, TEAM_ALL, aBuf, -1., CGameContext::CHAT_SIX);
GameServer()->SendChat(-1, TEAM_ALL, aBuf, -1., CGameContext::FLAG_SIX);
float Diff = absolute(Time - pData->m_BestTime);
@ -730,9 +730,9 @@ void CGameTeams::OnFinish(CPlayer *Player, int TimeTicks, const char *pTimestamp
str_format(aBuf, sizeof(aBuf), "New record: %5.2f second(s) better.",
Diff);
if(g_Config.m_SvHideScore || !g_Config.m_SvSaveWorseScores)
GameServer()->SendChatTarget(ClientId, aBuf, CGameContext::CHAT_SIX);
GameServer()->SendChatTarget(ClientId, aBuf, CGameContext::FLAG_SIX);
else
GameServer()->SendChat(-1, TEAM_ALL, aBuf, -1, CGameContext::CHAT_SIX);
GameServer()->SendChat(-1, TEAM_ALL, aBuf, -1, CGameContext::FLAG_SIX);
}
else if(pData->m_BestTime != 0) // tee has already finished?
{
@ -752,7 +752,7 @@ void CGameTeams::OnFinish(CPlayer *Player, int TimeTicks, const char *pTimestamp
str_format(aBuf, sizeof(aBuf),
"%5.2f second(s) worse, better luck next time.",
Diff);
GameServer()->SendChatTarget(ClientId, aBuf, CGameContext::CHAT_SIX); // this is private, sent only to the tee
GameServer()->SendChatTarget(ClientId, aBuf, CGameContext::FLAG_SIX); // this is private, sent only to the tee
}
}
else