mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-11 02:28:18 +00:00
89 lines
1.9 KiB
C++
89 lines
1.9 KiB
C++
/* (c) Shereef Marzouk. See "licence DDRace.txt" and the readme.txt in the root of the distribution for more information. */
|
|
#ifndef GAME_SERVER_TEAMS_H
|
|
#define GAME_SERVER_TEAMS_H
|
|
|
|
#include <game/teamscore.h>
|
|
#include <game/server/gamecontext.h>
|
|
|
|
class CGameTeams
|
|
{
|
|
int m_TeamState[MAX_CLIENTS];
|
|
int m_MembersCount[MAX_CLIENTS];
|
|
bool m_TeeFinished[MAX_CLIENTS];
|
|
|
|
class CGameContext * m_pGameContext;
|
|
|
|
public:
|
|
enum
|
|
{
|
|
TEAMSTATE_EMPTY, TEAMSTATE_OPEN, TEAMSTATE_STARTED, TEAMSTATE_FINISHED
|
|
};
|
|
|
|
CTeamsCore m_Core;
|
|
|
|
CGameTeams(CGameContext *pGameContext);
|
|
|
|
//helper methods
|
|
CCharacter* Character(int ClientID)
|
|
{
|
|
return GameServer()->GetPlayerChar(ClientID);
|
|
}
|
|
CPlayer* GetPlayer(int ClientID)
|
|
{
|
|
return GameServer()->m_apPlayers[ClientID];
|
|
}
|
|
|
|
class CGameContext *GameServer()
|
|
{
|
|
return m_pGameContext;
|
|
}
|
|
class IServer *Server()
|
|
{
|
|
return m_pGameContext->Server();
|
|
}
|
|
|
|
void OnCharacterStart(int ClientID);
|
|
void OnCharacterFinish(int ClientID);
|
|
|
|
bool SetCharacterTeam(int ClientID, int Team);
|
|
|
|
void ChangeTeamState(int Team, int State);
|
|
void onChangeTeamState(int Team, int State, int OldState);
|
|
|
|
bool TeamFinished(int Team);
|
|
|
|
int TeamMask(int Team, int ExceptID = -1, int Asker = -1);
|
|
|
|
int Count(int Team) const;
|
|
|
|
//need to be very carefull using this method
|
|
void SetForceCharacterTeam(int id, int Team);
|
|
|
|
void Reset();
|
|
|
|
void SendTeamsState(int Cid);
|
|
|
|
int m_LastChat[MAX_CLIENTS];
|
|
|
|
int GetDDRaceState(CPlayer* Player);
|
|
int GetStartTime(CPlayer* Player);
|
|
float *GetCpCurrent(CPlayer* Player);
|
|
void SetDDRaceState(CPlayer* Player, int DDRaceState);
|
|
void SetStartTime(CPlayer* Player, int StartTime);
|
|
void SetRefreshTime(CPlayer* Player, int RefreshTime);
|
|
void SetCpActive(CPlayer* Player, int CpActive);
|
|
void OnFinish(CPlayer* Player);
|
|
bool TeeFinished(int ClientID)
|
|
{
|
|
return m_TeeFinished[ClientID];
|
|
}
|
|
;
|
|
int GetTeamState(int Team)
|
|
{
|
|
return m_TeamState[Team];
|
|
}
|
|
;
|
|
};
|
|
|
|
#endif
|