ddnet/src/game/teamscore.h
Chairn a69dc599a9 Huge variable naming format
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
2022-07-08 18:01:29 +02:00

58 lines
1.3 KiB
C++

/* (c) Shereef Marzouk. See "licence DDRace.txt" and the readme.txt in the root of the distribution for more information. */
#ifndef GAME_TEAMSCORE_H
#define GAME_TEAMSCORE_H
#include <engine/shared/protocol.h>
enum
{
TEAM_FLOCK = 0,
TEAM_SUPER = MAX_CLIENTS,
NUM_TEAMS = TEAM_SUPER + 1,
VANILLA_TEAM_SUPER = VANILLA_MAX_CLIENTS
};
// do not change the values of the following enum
enum
{
SV_TEAM_FORBIDDEN = 0, // teams are disabled on the map
SV_TEAM_ALLOWED = 1, // teams are enabled on the map, but optional
SV_TEAM_MANDATORY = 2, // map must be played with a team
SV_TEAM_FORCED_SOLO = 3 // map forces a random team for each individual player
};
class CTeamsCore
{
int m_aTeam[MAX_CLIENTS];
bool m_aIsSolo[MAX_CLIENTS];
public:
bool m_IsDDRace16;
CTeamsCore();
bool SameTeam(int ClientID1, int ClientID2) const;
bool CanKeepHook(int ClientID1, int ClientID2) const;
bool CanCollide(int ClientID1, int ClientID2) const;
int Team(int ClientID) const;
void Team(int ClientID, int Team);
void Reset();
void SetSolo(int ClientID, bool Value)
{
dbg_assert(ClientID >= 0 && ClientID < MAX_CLIENTS, "Invalid client id");
m_aIsSolo[ClientID] = Value;
}
bool GetSolo(int ClientID) const
{
if(ClientID < 0 || ClientID >= MAX_CLIENTS)
return false;
return m_aIsSolo[ClientID];
}
};
#endif