ddnet/src/game/server/teams.h

70 lines
1.6 KiB
C
Raw Normal View History

2010-08-28 13:47:52 +00:00
#ifndef GAME_SERVER_TEAMS_H
#define GAME_SERVER_TEAMS_H
#include <game/teamscore.h>
2010-08-28 13:47:52 +00:00
#include <game/server/gamecontext.h>
class CGameTeams
{
2010-08-28 13:47:52 +00:00
int m_TeamState[MAX_CLIENTS];
2010-11-06 22:54:35 +00:00
int m_MembersCount[MAX_CLIENTS];
2010-08-28 13:47:52 +00:00
bool m_TeeFinished[MAX_CLIENTS];
class CGameContext * m_pGameContext;
2010-08-28 13:47:52 +00:00
2010-11-06 22:54:35 +00:00
2010-08-28 13:47:52 +00:00
public:
enum
{
TEAMSTATE_EMPTY,
TEAMSTATE_OPEN,
TEAMSTATE_CLOSED,
TEAMSTATE_STARTED,
TEAMSTATE_FINISHED
2010-08-28 13:47:52 +00:00
};
CTeamsCore m_Core;
CGameTeams(CGameContext *pGameContext);
2010-08-28 13:47:52 +00:00
//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(); }
2010-08-28 13:47:52 +00:00
void OnCharacterStart(int ClientID);
void OnCharacterFinish(int ClientID);
2010-08-28 13:47:52 +00:00
bool SetCharacterTeam(int ClientID, int Team);
2010-08-28 13:47:52 +00:00
void ChangeTeamState(int Team, int State);
2010-08-28 13:47:52 +00:00
bool TeamFinished(int Team);
2011-01-26 20:57:23 +00:00
int TeamMask(int Team, int ExceptID = -1);
2010-11-06 22:54:35 +00:00
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);
2010-08-28 13:47:52 +00:00
};
#endif