mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 18:18:18 +00:00
a69dc599a9
Fix pointer and pointer array variable naming Huge renaming to match our rules Used regex: (?!(return|delete)\b)\b\w+ (m_|ms_|g_|gs_|s_)[^a]\w+\[ (?!(return|delete)\b)\b\w+ (?!(m_|ms_|g_|gs_|s_))[^a]\w+\[ Further format static variables Format almost all pointer names accordingly Used regex: (?!(return)\b)\b\w+ \*(?!(m_p|p|s_p|m_ap|s_ap|g_p|g_ap|ap|gs_ap|ms_ap|gs_p|ms_p))\w+\b[^:\(p] clang-format Fix CI fail Fix misnamed non pointer as pointer and non array as array Used regex: (?!(return|delete)\b)\b\w+ (m_|ms_|g_|gs_|s_)p\w+\b (?!return\b)\b\w+ (ms_|m_|g_|gs_|s_)a\w+\b[^\[] clang-format Revert to SCREAMING_SNAKE_CASE and reinstate dead code
55 lines
1.5 KiB
C++
55 lines
1.5 KiB
C++
/* (c) Shereef Marzouk. See "licence DDRace.txt" and the readme.txt in the root of the distribution for more information. */
|
|
#include "teamscore.h"
|
|
#include <engine/shared/config.h>
|
|
|
|
CTeamsCore::CTeamsCore()
|
|
{
|
|
Reset();
|
|
}
|
|
|
|
bool CTeamsCore::SameTeam(int ClientID1, int ClientID2) const
|
|
{
|
|
return m_aTeam[ClientID1] == TEAM_SUPER || m_aTeam[ClientID2] == TEAM_SUPER || m_aTeam[ClientID1] == m_aTeam[ClientID2];
|
|
}
|
|
|
|
int CTeamsCore::Team(int ClientID) const
|
|
{
|
|
return m_aTeam[ClientID];
|
|
}
|
|
|
|
void CTeamsCore::Team(int ClientID, int Team)
|
|
{
|
|
dbg_assert(Team >= TEAM_FLOCK && Team <= TEAM_SUPER, "invalid team");
|
|
m_aTeam[ClientID] = Team;
|
|
}
|
|
|
|
bool CTeamsCore::CanKeepHook(int ClientID1, int ClientID2) const
|
|
{
|
|
if(m_aTeam[ClientID1] == (m_IsDDRace16 ? VANILLA_TEAM_SUPER : TEAM_SUPER) || m_aTeam[ClientID2] == (m_IsDDRace16 ? VANILLA_TEAM_SUPER : TEAM_SUPER) || ClientID1 == ClientID2)
|
|
return true;
|
|
return m_aTeam[ClientID1] == m_aTeam[ClientID2];
|
|
}
|
|
|
|
bool CTeamsCore::CanCollide(int ClientID1, int ClientID2) const
|
|
{
|
|
if(m_aTeam[ClientID1] == (m_IsDDRace16 ? VANILLA_TEAM_SUPER : TEAM_SUPER) || m_aTeam[ClientID2] == (m_IsDDRace16 ? VANILLA_TEAM_SUPER : TEAM_SUPER) || ClientID1 == ClientID2)
|
|
return true;
|
|
if(m_aIsSolo[ClientID1] || m_aIsSolo[ClientID2])
|
|
return false;
|
|
return m_aTeam[ClientID1] == m_aTeam[ClientID2];
|
|
}
|
|
|
|
void CTeamsCore::Reset()
|
|
{
|
|
m_IsDDRace16 = false;
|
|
|
|
for(int i = 0; i < MAX_CLIENTS; ++i)
|
|
{
|
|
if(g_Config.m_SvTeam == SV_TEAM_FORCED_SOLO)
|
|
m_aTeam[i] = i;
|
|
else
|
|
m_aTeam[i] = TEAM_FLOCK;
|
|
m_aIsSolo[i] = false;
|
|
}
|
|
}
|