2010-08-28 13:47:52 +00:00
|
|
|
#ifndef GAME_SERVER_TEAMS_H
|
|
|
|
#define GAME_SERVER_TEAMS_H
|
|
|
|
|
2010-08-30 12:13:43 +00:00
|
|
|
#include <game/teamscore.h>
|
2010-08-28 13:47:52 +00:00
|
|
|
#include <game/server/gamecontext.h>
|
|
|
|
|
2011-01-06 05:30:19 +00:00
|
|
|
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];
|
2011-02-02 10:49:19 +00:00
|
|
|
int m_TeamLeader[MAX_CLIENTS];
|
|
|
|
int m_TeeJoinTick[MAX_CLIENTS];
|
2011-02-14 21:34:46 +00:00
|
|
|
bool m_TeamStrict[MAX_CLIENTS];
|
2011-02-23 12:14:56 +00:00
|
|
|
bool m_TeePassedStart[MAX_CLIENTS];
|
2010-08-28 20:53:42 +00:00
|
|
|
|
|
|
|
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:
|
2011-02-02 10:49:19 +00:00
|
|
|
enum TeamState
|
2011-01-06 05:30:19 +00:00
|
|
|
{
|
2011-02-02 10:49:19 +00:00
|
|
|
TEAMSTATE_EMPTY,
|
|
|
|
TEAMSTATE_OPEN,
|
|
|
|
TEAMSTATE_STARTED
|
2010-08-28 13:47:52 +00:00
|
|
|
};
|
|
|
|
|
2010-08-30 12:13:43 +00:00
|
|
|
CTeamsCore m_Core;
|
|
|
|
|
|
|
|
CGameTeams(CGameContext *pGameContext);
|
2010-08-28 13:47:52 +00:00
|
|
|
|
|
|
|
//helper methods
|
2011-02-02 10:49:19 +00:00
|
|
|
CCharacter* Character(int ClientID) { return GameServer()->GetPlayerChar(ClientID); }
|
2010-08-28 20:53:42 +00:00
|
|
|
|
|
|
|
class CGameContext *GameServer() { return m_pGameContext; }
|
|
|
|
class IServer *Server() { return m_pGameContext->Server(); }
|
2010-08-28 13:47:52 +00:00
|
|
|
|
2011-02-02 10:49:19 +00:00
|
|
|
void OnCharacterStart(int ClientID);
|
|
|
|
void OnCharacterFinish(int ClientID);
|
2011-02-14 18:36:30 +00:00
|
|
|
void OnCharacterDeath(int ClientID);
|
2010-08-28 13:47:52 +00:00
|
|
|
|
2011-02-02 10:49:19 +00:00
|
|
|
int SetCharacterTeam(int ClientID, int Team);
|
|
|
|
enum TeamErrors
|
|
|
|
{
|
2011-02-23 12:14:56 +00:00
|
|
|
ERROR_WRONG_PARAMS = -6,
|
2011-02-02 10:49:19 +00:00
|
|
|
ERROR_CLOSED,
|
|
|
|
ERROR_ALREADY_THERE,
|
|
|
|
ERROR_NOT_SUPER,
|
2011-02-23 12:14:56 +00:00
|
|
|
ERROR_STARTED,
|
|
|
|
ERROR_PASSEDSTART
|
2011-02-02 10:49:19 +00:00
|
|
|
};
|
2010-08-28 13:47:52 +00:00
|
|
|
|
2011-02-02 10:49:19 +00:00
|
|
|
void ChangeTeamState(int Team, int State) { m_TeamState[Team] = State; };
|
2010-08-28 13:47:52 +00:00
|
|
|
|
|
|
|
bool TeamFinished(int Team);
|
2010-09-08 16:22:11 +00:00
|
|
|
|
2011-01-26 20:57:23 +00:00
|
|
|
int TeamMask(int Team, int ExceptID = -1);
|
2010-09-14 11:38:46 +00:00
|
|
|
|
2010-11-06 22:54:35 +00:00
|
|
|
int Count(int Team) const;
|
|
|
|
|
2011-02-02 10:49:19 +00:00
|
|
|
//need to be very careful using this method
|
|
|
|
void SetForceCharacterTeam(int ClientID, int Team);
|
2010-09-24 13:37:13 +00:00
|
|
|
|
|
|
|
void Reset();
|
2010-10-24 10:47:25 +00:00
|
|
|
|
2011-02-02 10:49:19 +00:00
|
|
|
void SendTeamsState(int ClientID);
|
2010-12-19 03:48:16 +00:00
|
|
|
|
|
|
|
int m_LastChat[MAX_CLIENTS];
|
2011-02-02 10:49:19 +00:00
|
|
|
|
|
|
|
bool GetTeamState(int Team) { return m_TeamState[Team]; };
|
|
|
|
|
|
|
|
int GetTeamLeader(int Team) { return m_TeamLeader[Team]; };
|
|
|
|
|
|
|
|
void SetTeamLeader(int Team, int ClientID);
|
2011-02-16 08:17:47 +00:00
|
|
|
void ToggleStrictness(int Team);
|
2010-08-28 13:47:52 +00:00
|
|
|
};
|
|
|
|
|
2010-09-08 16:22:11 +00:00
|
|
|
#endif
|