2010-11-20 10:37:14 +00:00
|
|
|
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
|
|
|
|
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
2010-05-29 07:25:38 +00:00
|
|
|
#ifndef GAME_SERVER_GAMECONTEXT_H
|
|
|
|
#define GAME_SERVER_GAMECONTEXT_H
|
|
|
|
|
|
|
|
#include <engine/console.h>
|
2020-09-26 19:41:58 +00:00
|
|
|
#include <engine/server.h>
|
2010-05-29 07:25:38 +00:00
|
|
|
|
2022-06-16 16:06:35 +00:00
|
|
|
#include <game/collision.h>
|
2010-05-29 07:25:38 +00:00
|
|
|
#include <game/layers.h>
|
2018-03-24 13:00:41 +00:00
|
|
|
#include <game/mapbugs.h>
|
2011-03-26 16:44:34 +00:00
|
|
|
#include <game/voting.h>
|
2010-05-29 07:25:38 +00:00
|
|
|
|
|
|
|
#include "eventhandler.h"
|
2022-03-27 11:31:07 +00:00
|
|
|
#include "game/generated/protocol.h"
|
2010-05-29 07:25:38 +00:00
|
|
|
#include "gameworld.h"
|
2017-09-12 12:58:44 +00:00
|
|
|
#include "teehistorian.h"
|
2010-05-29 07:25:38 +00:00
|
|
|
|
2020-09-25 16:11:59 +00:00
|
|
|
#include <memory>
|
2022-05-06 21:51:24 +00:00
|
|
|
#include <string>
|
2020-09-25 16:11:59 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
/*
|
|
|
|
Tick
|
|
|
|
Game Context (CGameContext::tick)
|
|
|
|
Game World (GAMEWORLD::tick)
|
|
|
|
Reset world if requested (GAMEWORLD::reset)
|
|
|
|
All entities in the world (ENTITY::tick)
|
|
|
|
All entities in the world (ENTITY::tick_defered)
|
|
|
|
Remove entities marked for deletion (GAMEWORLD::remove_entities)
|
|
|
|
Game Controller (GAMECONTROLLER::tick)
|
|
|
|
All players (CPlayer::tick)
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
|
|
|
|
Snap
|
|
|
|
Game Context (CGameContext::snap)
|
|
|
|
Game World (GAMEWORLD::snap)
|
|
|
|
All entities in the world (ENTITY::snap)
|
|
|
|
Game Controller (GAMECONTROLLER::snap)
|
|
|
|
Events handler (EVENT_HANDLER::snap)
|
|
|
|
All players (CPlayer::snap)
|
|
|
|
|
|
|
|
*/
|
2014-11-25 21:47:25 +00:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
2017-07-26 01:58:00 +00:00
|
|
|
NUM_TUNEZONES = 256
|
2014-11-25 21:47:25 +00:00
|
|
|
};
|
|
|
|
|
2022-06-17 17:54:10 +00:00
|
|
|
class CCharacter;
|
2021-01-10 12:47:07 +00:00
|
|
|
class CConfig;
|
2021-01-09 13:40:30 +00:00
|
|
|
class CHeap;
|
|
|
|
class CPlayer;
|
2020-07-04 17:53:27 +00:00
|
|
|
class CScore;
|
2022-06-17 17:54:10 +00:00
|
|
|
class CUnpacker;
|
|
|
|
class IAntibot;
|
2021-01-09 13:40:30 +00:00
|
|
|
class IGameController;
|
2018-06-19 12:45:53 +00:00
|
|
|
class IEngine;
|
2017-10-13 00:25:50 +00:00
|
|
|
class IStorage;
|
2022-06-17 17:54:10 +00:00
|
|
|
struct CAntibotRoundData;
|
2020-06-24 21:14:09 +00:00
|
|
|
struct CScoreRandomMapResult;
|
2017-10-13 00:25:50 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
class CGameContext : public IGameServer
|
|
|
|
{
|
|
|
|
IServer *m_pServer;
|
2021-01-10 12:47:07 +00:00
|
|
|
CConfig *m_pConfig;
|
2018-06-19 12:45:53 +00:00
|
|
|
IConsole *m_pConsole;
|
|
|
|
IEngine *m_pEngine;
|
2017-10-13 00:25:50 +00:00
|
|
|
IStorage *m_pStorage;
|
2020-05-13 20:27:49 +00:00
|
|
|
IAntibot *m_pAntibot;
|
2010-05-29 07:25:38 +00:00
|
|
|
CLayers m_Layers;
|
|
|
|
CCollision m_Collision;
|
2020-04-16 08:46:43 +00:00
|
|
|
protocol7::CNetObjHandler m_NetObjHandler7;
|
2010-05-29 07:25:38 +00:00
|
|
|
CNetObjHandler m_NetObjHandler;
|
|
|
|
CTuningParams m_Tuning;
|
2017-07-26 01:58:00 +00:00
|
|
|
CTuningParams m_aTuningList[NUM_TUNEZONES];
|
2022-05-23 20:35:21 +00:00
|
|
|
std::vector<std::string> m_vCensorlist;
|
2010-05-29 07:25:38 +00:00
|
|
|
|
2017-09-12 12:58:44 +00:00
|
|
|
bool m_TeeHistorianActive;
|
|
|
|
CTeeHistorian m_TeeHistorian;
|
2017-10-10 02:07:38 +00:00
|
|
|
ASYNCIO *m_pTeeHistorianFile;
|
2018-02-07 15:43:36 +00:00
|
|
|
CUuid m_GameUuid;
|
2018-03-24 13:00:41 +00:00
|
|
|
CMapBugs m_MapBugs;
|
2020-05-25 13:08:24 +00:00
|
|
|
CPrng m_Prng;
|
2017-09-12 12:58:44 +00:00
|
|
|
|
2021-07-22 19:49:26 +00:00
|
|
|
bool m_Resetting;
|
|
|
|
|
2017-09-13 20:35:09 +00:00
|
|
|
static void CommandCallback(int ClientID, int FlagMask, const char *pCmd, IConsole::IResult *pResult, void *pUser);
|
2017-09-12 12:58:44 +00:00
|
|
|
static void TeeHistorianWrite(const void *pData, int DataSize, void *pUser);
|
|
|
|
|
2011-08-13 00:11:06 +00:00
|
|
|
static void ConTuneParam(IConsole::IResult *pResult, void *pUserData);
|
2018-12-20 08:18:22 +00:00
|
|
|
static void ConToggleTuneParam(IConsole::IResult *pResult, void *pUserData);
|
2011-08-13 00:11:06 +00:00
|
|
|
static void ConTuneReset(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConTuneDump(IConsole::IResult *pResult, void *pUserData);
|
2014-03-12 23:31:50 +00:00
|
|
|
static void ConTuneZone(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConTuneDumpZone(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConTuneResetZone(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConTuneSetZoneMsgEnter(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConTuneSetZoneMsgLeave(IConsole::IResult *pResult, void *pUserData);
|
2018-05-01 10:38:33 +00:00
|
|
|
static void ConMapbug(IConsole::IResult *pResult, void *pUserData);
|
2015-07-22 21:31:50 +00:00
|
|
|
static void ConSwitchOpen(IConsole::IResult *pResult, void *pUserData);
|
2012-01-09 23:49:31 +00:00
|
|
|
static void ConPause(IConsole::IResult *pResult, void *pUserData);
|
2011-08-13 00:11:06 +00:00
|
|
|
static void ConChangeMap(IConsole::IResult *pResult, void *pUserData);
|
2013-12-06 23:15:56 +00:00
|
|
|
static void ConRandomMap(IConsole::IResult *pResult, void *pUserData);
|
2014-06-20 20:40:23 +00:00
|
|
|
static void ConRandomUnfinishedMap(IConsole::IResult *pResult, void *pUserData);
|
2011-08-13 00:11:06 +00:00
|
|
|
static void ConRestart(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConBroadcast(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConSay(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConSetTeam(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConSetTeamAll(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConAddVote(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConRemoveVote(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConForceVote(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConClearVotes(IConsole::IResult *pResult, void *pUserData);
|
2020-10-17 22:05:59 +00:00
|
|
|
static void ConAddMapVotes(IConsole::IResult *pResult, void *pUserData);
|
2011-08-13 00:11:06 +00:00
|
|
|
static void ConVote(IConsole::IResult *pResult, void *pUserData);
|
2018-01-18 15:17:23 +00:00
|
|
|
static void ConVoteNo(IConsole::IResult *pResult, void *pUserData);
|
2020-02-13 15:16:35 +00:00
|
|
|
static void ConDrySave(IConsole::IResult *pResult, void *pUserData);
|
2020-03-11 00:58:50 +00:00
|
|
|
static void ConDumpAntibot(IConsole::IResult *pResult, void *pUserData);
|
2010-05-29 07:25:38 +00:00
|
|
|
static void ConchainSpecialMotdupdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
void Construct(int Resetting);
|
2021-06-29 20:32:21 +00:00
|
|
|
void Destruct(int Resetting);
|
2020-10-17 22:05:59 +00:00
|
|
|
void AddVote(const char *pDescription, const char *pCommand);
|
|
|
|
static int MapScan(const char *pName, int IsDir, int DirType, void *pUserData);
|
2010-05-29 07:25:38 +00:00
|
|
|
|
2021-02-07 15:03:31 +00:00
|
|
|
struct CPersistentClientData
|
|
|
|
{
|
|
|
|
bool m_IsSpectator;
|
|
|
|
};
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
public:
|
|
|
|
IServer *Server() const { return m_pServer; }
|
2021-01-10 12:47:07 +00:00
|
|
|
CConfig *Config() { return m_pConfig; }
|
2018-06-19 12:45:53 +00:00
|
|
|
IConsole *Console() { return m_pConsole; }
|
|
|
|
IEngine *Engine() { return m_pEngine; }
|
2017-10-13 00:25:50 +00:00
|
|
|
IStorage *Storage() { return m_pStorage; }
|
2010-05-29 07:25:38 +00:00
|
|
|
CCollision *Collision() { return &m_Collision; }
|
|
|
|
CTuningParams *Tuning() { return &m_Tuning; }
|
2017-07-26 01:58:00 +00:00
|
|
|
CTuningParams *TuningList() { return &m_aTuningList[0]; }
|
2020-05-13 20:27:49 +00:00
|
|
|
IAntibot *Antibot() { return m_pAntibot; }
|
2020-06-20 14:19:49 +00:00
|
|
|
CTeeHistorian *TeeHistorian() { return &m_TeeHistorian; }
|
|
|
|
bool TeeHistorianActive() const { return m_TeeHistorianActive; }
|
2010-05-29 07:25:38 +00:00
|
|
|
|
|
|
|
CGameContext();
|
2021-07-22 19:49:26 +00:00
|
|
|
CGameContext(int Reset);
|
2010-05-29 07:25:38 +00:00
|
|
|
~CGameContext();
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
void Clear();
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
CEventHandler m_Events;
|
|
|
|
CPlayer *m_apPlayers[MAX_CLIENTS];
|
2022-03-27 11:31:07 +00:00
|
|
|
// keep last input to always apply when none is sent
|
|
|
|
CNetObj_PlayerInput m_aLastPlayerInput[MAX_CLIENTS];
|
|
|
|
bool m_aPlayerHasInput[MAX_CLIENTS];
|
2010-05-29 07:25:38 +00:00
|
|
|
|
2022-05-18 08:45:31 +00:00
|
|
|
// returns last input if available otherwise nulled PlayerInput object
|
|
|
|
// ClientID has to be valid
|
|
|
|
CNetObj_PlayerInput GetLastPlayerInput(int ClientID) const;
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
IGameController *m_pController;
|
|
|
|
CGameWorld m_World;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
// helper functions
|
2011-02-12 10:40:36 +00:00
|
|
|
class CCharacter *GetPlayerChar(int ClientID);
|
2018-03-24 13:00:41 +00:00
|
|
|
bool EmulateBug(int Bug);
|
2022-06-11 19:38:18 +00:00
|
|
|
std::vector<SSwitchers> &Switchers() { return m_World.m_Core.m_vSwitchers; }
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
// voting
|
2020-08-04 17:14:37 +00:00
|
|
|
void StartVote(const char *pDesc, const char *pCommand, const char *pReason, const char *pSixupDesc);
|
2010-05-29 07:25:38 +00:00
|
|
|
void EndVote();
|
2011-02-12 10:40:36 +00:00
|
|
|
void SendVoteSet(int ClientID);
|
|
|
|
void SendVoteStatus(int ClientID, int Total, int Yes, int No);
|
|
|
|
void AbortVoteKickOnDisconnect(int ClientID);
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
int m_VoteCreator;
|
2020-07-01 12:02:47 +00:00
|
|
|
int m_VoteType;
|
2021-06-23 05:05:49 +00:00
|
|
|
int64_t m_VoteCloseTime;
|
2010-05-29 07:25:38 +00:00
|
|
|
bool m_VoteUpdate;
|
|
|
|
int m_VotePos;
|
2011-03-26 16:44:34 +00:00
|
|
|
char m_aVoteDescription[VOTE_DESC_LENGTH];
|
2020-08-04 17:14:37 +00:00
|
|
|
char m_aSixupVoteDescription[VOTE_DESC_LENGTH];
|
2011-03-26 16:44:34 +00:00
|
|
|
char m_aVoteCommand[VOTE_CMD_LENGTH];
|
|
|
|
char m_aVoteReason[VOTE_REASON_LENGTH];
|
2011-03-26 21:06:29 +00:00
|
|
|
int m_NumVoteOptions;
|
2010-05-29 07:25:38 +00:00
|
|
|
int m_VoteEnforce;
|
2017-07-26 01:58:00 +00:00
|
|
|
char m_aaZoneEnterMsg[NUM_TUNEZONES][256]; // 0 is used for switching from or to area without tunings
|
|
|
|
char m_aaZoneLeaveMsg[NUM_TUNEZONES][256];
|
2015-07-09 00:08:14 +00:00
|
|
|
|
2015-07-14 20:08:29 +00:00
|
|
|
char m_aDeleteTempfile[128];
|
|
|
|
void DeleteTempfile();
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
enum
|
|
|
|
{
|
2020-09-26 19:41:58 +00:00
|
|
|
VOTE_ENFORCE_UNKNOWN = 0,
|
2010-05-29 07:25:38 +00:00
|
|
|
VOTE_ENFORCE_NO,
|
|
|
|
VOTE_ENFORCE_YES,
|
2020-07-01 12:02:47 +00:00
|
|
|
VOTE_ENFORCE_ABORT,
|
2010-05-29 07:25:38 +00:00
|
|
|
};
|
|
|
|
CHeap *m_pVoteOptionHeap;
|
2011-03-26 16:44:34 +00:00
|
|
|
CVoteOptionServer *m_pVoteOptionFirst;
|
|
|
|
CVoteOptionServer *m_pVoteOptionLast;
|
2010-05-29 07:25:38 +00:00
|
|
|
|
|
|
|
// helper functions
|
2021-06-23 05:05:49 +00:00
|
|
|
void CreateDamageInd(vec2 Pos, float AngleMod, int Amount, int64_t Mask = -1);
|
|
|
|
void CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamage, int ActivatedTeam, int64_t Mask);
|
|
|
|
void CreateHammerHit(vec2 Pos, int64_t Mask = -1);
|
|
|
|
void CreatePlayerSpawn(vec2 Pos, int64_t Mask = -1);
|
2022-01-22 13:12:59 +00:00
|
|
|
void CreateDeath(vec2 Pos, int ClientID, int64_t Mask = -1);
|
2021-06-23 05:05:49 +00:00
|
|
|
void CreateSound(vec2 Pos, int Sound, int64_t Mask = -1);
|
2020-09-26 19:41:58 +00:00
|
|
|
void CreateSoundGlobal(int Sound, int Target = -1);
|
2011-01-29 00:59:50 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
enum
|
|
|
|
{
|
2020-09-26 19:41:58 +00:00
|
|
|
CHAT_ALL = -2,
|
|
|
|
CHAT_SPEC = -1,
|
|
|
|
CHAT_RED = 0,
|
|
|
|
CHAT_BLUE = 1,
|
|
|
|
CHAT_WHISPER_SEND = 2,
|
|
|
|
CHAT_WHISPER_RECV = 3,
|
|
|
|
|
|
|
|
CHAT_SIX = 1 << 0,
|
|
|
|
CHAT_SIXUP = 1 << 1,
|
2010-05-29 07:25:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// network
|
2022-01-22 13:12:59 +00:00
|
|
|
void CallVote(int ClientID, const char *pDesc, const char *pCmd, const char *pReason, const char *pChatmsg, const char *pSixupDesc = 0);
|
2020-06-22 15:08:08 +00:00
|
|
|
void SendChatTarget(int To, const char *pText, int Flags = CHAT_SIX | CHAT_SIXUP);
|
2014-07-26 12:46:31 +00:00
|
|
|
void SendChatTeam(int Team, const char *pText);
|
2020-06-12 13:25:58 +00:00
|
|
|
void SendChat(int ClientID, int Team, const char *pText, int SpamProtectionClientID = -1, int Flags = CHAT_SIX | CHAT_SIXUP);
|
2021-12-21 22:22:26 +00:00
|
|
|
void SendStartWarning(int ClientID, const char *pMessage);
|
2011-02-12 10:40:36 +00:00
|
|
|
void SendEmoticon(int ClientID, int Emoticon);
|
|
|
|
void SendWeaponPickup(int ClientID, int Weapon);
|
2021-01-09 13:05:54 +00:00
|
|
|
void SendMotd(int ClientID);
|
|
|
|
void SendSettings(int ClientID);
|
2018-03-07 16:22:41 +00:00
|
|
|
void SendBroadcast(const char *pText, int ClientID, bool IsImportant = true);
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2020-09-26 19:41:58 +00:00
|
|
|
void List(int ClientID, const char *filter);
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
//
|
|
|
|
void CheckPureTuning();
|
2014-03-29 22:34:36 +00:00
|
|
|
void SendTuningParams(int ClientID, int Zone = 0);
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2015-04-18 20:29:28 +00:00
|
|
|
struct CVoteOptionServer *GetVoteOption(int Index);
|
2014-10-26 18:39:42 +00:00
|
|
|
void ProgressVoteOptions(int ClientID);
|
|
|
|
|
2011-12-30 21:47:26 +00:00
|
|
|
//
|
2011-07-13 20:38:32 +00:00
|
|
|
void LoadMapSettings();
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
// engine events
|
2022-05-17 20:13:44 +00:00
|
|
|
void OnInit() override;
|
|
|
|
void OnConsoleInit() override;
|
|
|
|
void OnMapChange(char *pNewMapName, int MapNameSize) override;
|
|
|
|
void OnShutdown() override;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2022-05-17 20:13:44 +00:00
|
|
|
void OnTick() override;
|
|
|
|
void OnPreSnap() override;
|
|
|
|
void OnSnap(int ClientID) override;
|
|
|
|
void OnPostSnap() override;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2020-06-10 16:12:10 +00:00
|
|
|
void *PreProcessMsg(int *MsgID, CUnpacker *pUnpacker, int ClientID);
|
2020-09-18 15:37:27 +00:00
|
|
|
void CensorMessage(char *pCensoredMessage, const char *pMessage, int Size);
|
2022-05-17 20:13:44 +00:00
|
|
|
void OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID) override;
|
2010-05-29 07:25:38 +00:00
|
|
|
|
2022-05-17 20:13:44 +00:00
|
|
|
bool OnClientDataPersist(int ClientID, void *pData) override;
|
|
|
|
void OnClientConnected(int ClientID, void *pData) override;
|
|
|
|
void OnClientEnter(int ClientID) override;
|
|
|
|
void OnClientDrop(int ClientID, const char *pReason) override;
|
|
|
|
void OnClientDirectInput(int ClientID, void *pInput) override;
|
|
|
|
void OnClientPredictedInput(int ClientID, void *pInput) override;
|
|
|
|
void OnClientPredictedEarlyInput(int ClientID, void *pInput) override;
|
2010-12-19 13:11:14 +00:00
|
|
|
|
2022-05-17 20:13:44 +00:00
|
|
|
void OnClientEngineJoin(int ClientID, bool Sixup) override;
|
|
|
|
void OnClientEngineDrop(int ClientID, const char *pReason) override;
|
2017-09-13 20:35:09 +00:00
|
|
|
|
2022-05-17 20:13:44 +00:00
|
|
|
bool IsClientReady(int ClientID) const override;
|
|
|
|
bool IsClientPlayer(int ClientID) const override;
|
|
|
|
int PersistentClientDataSize() const override { return sizeof(CPersistentClientData); }
|
2011-03-15 08:58:57 +00:00
|
|
|
|
2022-05-17 20:13:44 +00:00
|
|
|
CUuid GameUuid() const override;
|
|
|
|
const char *GameType() const override;
|
|
|
|
const char *Version() const override;
|
|
|
|
const char *NetVersion() const override;
|
2011-01-29 00:59:50 +00:00
|
|
|
|
2011-04-09 06:41:31 +00:00
|
|
|
// DDRace
|
2022-05-17 20:13:44 +00:00
|
|
|
void OnPreTickTeehistorian() override;
|
2021-02-11 11:42:26 +00:00
|
|
|
bool OnClientDDNetVersionKnown(int ClientID);
|
2022-05-17 20:13:44 +00:00
|
|
|
void FillAntibot(CAntibotRoundData *pData) override;
|
2021-06-23 06:51:11 +00:00
|
|
|
int ProcessSpamProtection(int ClientID, bool RespectChatInitialDelay = true);
|
2011-04-19 19:44:02 +00:00
|
|
|
int GetDDRaceTeam(int ClientID);
|
2016-01-19 22:52:28 +00:00
|
|
|
// Describes the time when the first player joined the server.
|
2021-06-23 05:05:49 +00:00
|
|
|
int64_t m_NonEmptySince;
|
|
|
|
int64_t m_LastMapVote;
|
2021-02-08 21:26:26 +00:00
|
|
|
int GetClientVersion(int ClientID) const;
|
2022-06-25 09:16:59 +00:00
|
|
|
int64_t ClientsMaskExcludeClientVersionAndHigher(int Version);
|
2022-05-17 20:13:44 +00:00
|
|
|
bool PlayerExists(int ClientID) const override { return m_apPlayers[ClientID]; }
|
2018-01-05 11:04:06 +00:00
|
|
|
// Returns true if someone is actively moderating.
|
2021-02-08 21:26:26 +00:00
|
|
|
bool PlayerModerating() const;
|
2018-01-18 15:17:23 +00:00
|
|
|
void ForceVote(int EnforcerID, bool Success);
|
2011-04-09 06:41:31 +00:00
|
|
|
|
2020-06-14 08:44:14 +00:00
|
|
|
// Checks if player can vote and notify them about the reason
|
|
|
|
bool RateLimitPlayerVote(int ClientID);
|
|
|
|
bool RateLimitPlayerMapVote(int ClientID);
|
|
|
|
|
2020-06-24 21:14:09 +00:00
|
|
|
std::shared_ptr<CScoreRandomMapResult> m_SqlRandomMapResult;
|
2020-06-21 22:45:17 +00:00
|
|
|
|
2011-01-29 00:59:50 +00:00
|
|
|
private:
|
2022-03-27 11:31:07 +00:00
|
|
|
// starting 1 to make 0 the special value "no client id"
|
|
|
|
uint32_t NextUniqueClientID = 1;
|
2011-04-09 06:41:31 +00:00
|
|
|
bool m_VoteWillPass;
|
2022-06-17 17:54:10 +00:00
|
|
|
CScore *m_pScore;
|
2011-01-29 00:59:50 +00:00
|
|
|
|
|
|
|
//DDRace Console Commands
|
|
|
|
|
2011-08-13 00:11:06 +00:00
|
|
|
static void ConKillPlayer(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
|
|
|
|
static void ConNinja(IConsole::IResult *pResult, void *pUserData);
|
2020-12-26 22:09:33 +00:00
|
|
|
static void ConEndlessHook(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConUnEndlessHook(IConsole::IResult *pResult, void *pUserData);
|
2014-06-11 15:53:59 +00:00
|
|
|
static void ConUnSolo(IConsole::IResult *pResult, void *pUserData);
|
2014-06-13 21:49:34 +00:00
|
|
|
static void ConUnDeep(IConsole::IResult *pResult, void *pUserData);
|
2022-04-18 14:37:35 +00:00
|
|
|
static void ConLiveFreeze(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConUnLiveFreeze(IConsole::IResult *pResult, void *pUserData);
|
2011-08-13 00:11:06 +00:00
|
|
|
static void ConUnSuper(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConSuper(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConShotgun(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConGrenade(IConsole::IResult *pResult, void *pUserData);
|
2019-11-22 14:37:18 +00:00
|
|
|
static void ConLaser(IConsole::IResult *pResult, void *pUserData);
|
2016-10-08 17:42:42 +00:00
|
|
|
static void ConJetpack(IConsole::IResult *pResult, void *pUserData);
|
2011-08-13 00:11:06 +00:00
|
|
|
static void ConWeapons(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConUnShotgun(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConUnGrenade(IConsole::IResult *pResult, void *pUserData);
|
2019-11-22 14:37:18 +00:00
|
|
|
static void ConUnLaser(IConsole::IResult *pResult, void *pUserData);
|
2016-10-08 17:42:42 +00:00
|
|
|
static void ConUnJetpack(IConsole::IResult *pResult, void *pUserData);
|
2011-08-13 00:11:06 +00:00
|
|
|
static void ConUnWeapons(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConAddWeapon(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConRemoveWeapon(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
|
|
|
|
void ModifyWeapons(IConsole::IResult *pResult, void *pUserData, int Weapon, bool Remove);
|
|
|
|
void MoveCharacter(int ClientID, int X, int Y, bool Raw = false);
|
|
|
|
static void ConGoLeft(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConGoRight(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConGoUp(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConGoDown(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConMove(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConMoveRaw(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
|
2013-07-23 21:37:00 +00:00
|
|
|
static void ConToTeleporter(IConsole::IResult *pResult, void *pUserData);
|
2014-02-11 21:36:55 +00:00
|
|
|
static void ConToCheckTeleporter(IConsole::IResult *pResult, void *pUserData);
|
2022-01-09 23:25:51 +00:00
|
|
|
void Teleport(CCharacter *pChr, vec2 Pos);
|
2011-08-13 00:11:06 +00:00
|
|
|
static void ConTeleport(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
|
|
|
|
static void ConCredits(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConInfo(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConHelp(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConSettings(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConRules(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConKill(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConTogglePause(IConsole::IResult *pResult, void *pUserData);
|
2018-03-01 18:46:04 +00:00
|
|
|
static void ConTogglePauseVoted(IConsole::IResult *pResult, void *pUserData);
|
2011-12-29 13:58:39 +00:00
|
|
|
static void ConToggleSpec(IConsole::IResult *pResult, void *pUserData);
|
2018-03-01 18:46:04 +00:00
|
|
|
static void ConToggleSpecVoted(IConsole::IResult *pResult, void *pUserData);
|
2011-08-13 00:11:06 +00:00
|
|
|
static void ConForcePause(IConsole::IResult *pResult, void *pUserData);
|
2013-07-21 06:46:52 +00:00
|
|
|
static void ConTeamTop5(IConsole::IResult *pResult, void *pUserData);
|
2021-03-07 22:41:48 +00:00
|
|
|
static void ConTop(IConsole::IResult *pResult, void *pUserData);
|
2011-08-13 00:11:06 +00:00
|
|
|
static void ConTimes(IConsole::IResult *pResult, void *pUserData);
|
2013-07-21 02:52:23 +00:00
|
|
|
static void ConPoints(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConTopPoints(IConsole::IResult *pResult, void *pUserData);
|
2022-06-08 15:08:12 +00:00
|
|
|
static void ConTimeCP(IConsole::IResult *pResult, void *pUserData);
|
2011-03-22 19:15:15 +00:00
|
|
|
|
2011-08-13 00:11:06 +00:00
|
|
|
static void ConUTF8(IConsole::IResult *pResult, void *pUserData);
|
2013-12-22 17:30:13 +00:00
|
|
|
static void ConDND(IConsole::IResult *pResult, void *pUserData);
|
2014-10-11 10:58:27 +00:00
|
|
|
static void ConMapInfo(IConsole::IResult *pResult, void *pUserData);
|
2014-08-09 15:25:29 +00:00
|
|
|
static void ConTimeout(IConsole::IResult *pResult, void *pUserData);
|
2020-05-22 21:59:47 +00:00
|
|
|
static void ConPractice(IConsole::IResult *pResult, void *pUserData);
|
2021-02-28 16:35:35 +00:00
|
|
|
static void ConSwap(IConsole::IResult *pResult, void *pUserData);
|
2014-07-26 12:46:31 +00:00
|
|
|
static void ConSave(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConLoad(IConsole::IResult *pResult, void *pUserData);
|
2014-02-19 20:22:36 +00:00
|
|
|
static void ConMap(IConsole::IResult *pResult, void *pUserData);
|
2013-07-21 06:46:52 +00:00
|
|
|
static void ConTeamRank(IConsole::IResult *pResult, void *pUserData);
|
2011-08-13 00:11:06 +00:00
|
|
|
static void ConRank(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConBroadTime(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConJoinTeam(IConsole::IResult *pResult, void *pUserData);
|
2013-11-15 23:44:49 +00:00
|
|
|
static void ConLockTeam(IConsole::IResult *pResult, void *pUserData);
|
2020-05-23 15:55:56 +00:00
|
|
|
static void ConUnlockTeam(IConsole::IResult *pResult, void *pUserData);
|
2017-04-23 20:50:07 +00:00
|
|
|
static void ConInviteTeam(IConsole::IResult *pResult, void *pUserData);
|
2011-08-13 00:11:06 +00:00
|
|
|
static void ConMe(IConsole::IResult *pResult, void *pUserData);
|
2013-08-09 13:04:20 +00:00
|
|
|
static void ConWhisper(IConsole::IResult *pResult, void *pUserData);
|
2013-10-18 09:42:35 +00:00
|
|
|
static void ConConverse(IConsole::IResult *pResult, void *pUserData);
|
Added the following settings to Close #123.
sv_time_in_broadcast, 1, 0, 1, CFGFLAG_SERVER, "Whether to display time in broadcast every interval or not by default, later the choice can be changed by players via chat commands"
sv_time_in_broadcast_interval, 1, 0, 60, CFGFLAG_SERVER, "How often to update the broadcast time"
sv_time_in_gametimer, 0, 0, 1, CFGFLAG_SERVER, "Whether to display time in the round/game timer or not by default, later the choice can be changed by players via chat commands"
Added the following Chat commands to give the player the choice over their settings:
"saytime", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTime, this, "Privately messages you your current time in this current running race"
"saytimeall", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTimeAll, this, "Publicly messages everyone your current time in this current running race"
"time", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConTime, this, "Privately shows you your current time in this current running race in the broadcast message"
"broadcasttime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetBroadcastTime, this, "Personal Setting of showing time in the broadcast, broadcasttime s, where s = on for on, off for off, toggle for toggle and nothing to show current status"
"servergametime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetServerGameTime, this, "Personal Setting of showing time in the round/game timer, servergametime s, where s = on for on off for off, toggle for toggle and nothing to show current status"
Fixed Chat Command "eyeemote" and made it a set + toggle instead of just toggle for better bin techneques
Moved some vars from CCharacter to CPlayer to keep their status evern after death but not after disconnect.
So now players have the choice to see which timer they wanna see if any.
Note: These changes are all untested Stay away from this update on your main server until they are tested, i don't even know if they will compile propperly
2011-12-29 12:17:34 +00:00
|
|
|
static void ConSetEyeEmote(IConsole::IResult *pResult, void *pUserData);
|
2011-08-13 00:11:06 +00:00
|
|
|
static void ConToggleBroadcast(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConEyeEmote(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConShowOthers(IConsole::IResult *pResult, void *pUserData);
|
2014-02-02 18:56:10 +00:00
|
|
|
static void ConShowAll(IConsole::IResult *pResult, void *pUserData);
|
2014-08-09 17:53:38 +00:00
|
|
|
static void ConSpecTeam(IConsole::IResult *pResult, void *pUserData);
|
2014-01-11 12:59:20 +00:00
|
|
|
static void ConNinjaJetpack(IConsole::IResult *pResult, void *pUserData);
|
Added the following settings to Close #123.
sv_time_in_broadcast, 1, 0, 1, CFGFLAG_SERVER, "Whether to display time in broadcast every interval or not by default, later the choice can be changed by players via chat commands"
sv_time_in_broadcast_interval, 1, 0, 60, CFGFLAG_SERVER, "How often to update the broadcast time"
sv_time_in_gametimer, 0, 0, 1, CFGFLAG_SERVER, "Whether to display time in the round/game timer or not by default, later the choice can be changed by players via chat commands"
Added the following Chat commands to give the player the choice over their settings:
"saytime", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTime, this, "Privately messages you your current time in this current running race"
"saytimeall", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTimeAll, this, "Publicly messages everyone your current time in this current running race"
"time", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConTime, this, "Privately shows you your current time in this current running race in the broadcast message"
"broadcasttime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetBroadcastTime, this, "Personal Setting of showing time in the broadcast, broadcasttime s, where s = on for on, off for off, toggle for toggle and nothing to show current status"
"servergametime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetServerGameTime, this, "Personal Setting of showing time in the round/game timer, servergametime s, where s = on for on off for off, toggle for toggle and nothing to show current status"
Fixed Chat Command "eyeemote" and made it a set + toggle instead of just toggle for better bin techneques
Moved some vars from CCharacter to CPlayer to keep their status evern after death but not after disconnect.
So now players have the choice to see which timer they wanna see if any.
Note: These changes are all untested Stay away from this update on your main server until they are tested, i don't even know if they will compile propperly
2011-12-29 12:17:34 +00:00
|
|
|
static void ConSayTime(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConSayTimeAll(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConTime(IConsole::IResult *pResult, void *pUserData);
|
2012-02-14 18:25:34 +00:00
|
|
|
static void ConSetTimerType(IConsole::IResult *pResult, void *pUserData);
|
2015-04-16 15:28:03 +00:00
|
|
|
static void ConRescue(IConsole::IResult *pResult, void *pUserData);
|
2022-01-09 13:27:59 +00:00
|
|
|
static void ConTele(IConsole::IResult *pResult, void *pUserData);
|
2014-08-24 21:24:33 +00:00
|
|
|
static void ConProtectedKill(IConsole::IResult *pResult, void *pUserData);
|
Added the following settings to Close #123.
sv_time_in_broadcast, 1, 0, 1, CFGFLAG_SERVER, "Whether to display time in broadcast every interval or not by default, later the choice can be changed by players via chat commands"
sv_time_in_broadcast_interval, 1, 0, 60, CFGFLAG_SERVER, "How often to update the broadcast time"
sv_time_in_gametimer, 0, 0, 1, CFGFLAG_SERVER, "Whether to display time in the round/game timer or not by default, later the choice can be changed by players via chat commands"
Added the following Chat commands to give the player the choice over their settings:
"saytime", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTime, this, "Privately messages you your current time in this current running race"
"saytimeall", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTimeAll, this, "Publicly messages everyone your current time in this current running race"
"time", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConTime, this, "Privately shows you your current time in this current running race in the broadcast message"
"broadcasttime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetBroadcastTime, this, "Personal Setting of showing time in the broadcast, broadcasttime s, where s = on for on, off for off, toggle for toggle and nothing to show current status"
"servergametime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetServerGameTime, this, "Personal Setting of showing time in the round/game timer, servergametime s, where s = on for on off for off, toggle for toggle and nothing to show current status"
Fixed Chat Command "eyeemote" and made it a set + toggle instead of just toggle for better bin techneques
Moved some vars from CCharacter to CPlayer to keep their status evern after death but not after disconnect.
So now players have the choice to see which timer they wanna see if any.
Note: These changes are all untested Stay away from this update on your main server until they are tested, i don't even know if they will compile propperly
2011-12-29 12:17:34 +00:00
|
|
|
|
2018-04-19 09:49:18 +00:00
|
|
|
static void ConVoteMute(IConsole::IResult *pResult, void *pUserData);
|
2019-03-19 19:18:11 +00:00
|
|
|
static void ConVoteUnmute(IConsole::IResult *pResult, void *pUserData);
|
2019-03-19 19:25:21 +00:00
|
|
|
static void ConVoteMutes(IConsole::IResult *pResult, void *pUserData);
|
2011-08-13 00:11:06 +00:00
|
|
|
static void ConMute(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConMuteID(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConMuteIP(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConUnmute(IConsole::IResult *pResult, void *pUserData);
|
2021-12-18 10:28:54 +00:00
|
|
|
static void ConUnmuteID(IConsole::IResult *pResult, void *pUserData);
|
2011-08-13 00:11:06 +00:00
|
|
|
static void ConMutes(IConsole::IResult *pResult, void *pUserData);
|
2018-01-05 11:04:06 +00:00
|
|
|
static void ConModerate(IConsole::IResult *pResult, void *pUserData);
|
2011-02-08 12:44:59 +00:00
|
|
|
|
2013-12-31 05:13:57 +00:00
|
|
|
static void ConList(IConsole::IResult *pResult, void *pUserData);
|
2017-04-25 17:10:22 +00:00
|
|
|
static void ConSetDDRTeam(IConsole::IResult *pResult, void *pUserData);
|
2019-03-01 21:11:00 +00:00
|
|
|
static void ConUninvite(IConsole::IResult *pResult, void *pUserData);
|
2014-07-16 00:59:39 +00:00
|
|
|
static void ConFreezeHammer(IConsole::IResult *pResult, void *pUserData);
|
|
|
|
static void ConUnFreezeHammer(IConsole::IResult *pResult, void *pUserData);
|
2013-12-31 05:13:57 +00:00
|
|
|
|
2011-02-23 21:39:53 +00:00
|
|
|
enum
|
|
|
|
{
|
2020-09-26 19:41:58 +00:00
|
|
|
MAX_MUTES = 32,
|
|
|
|
MAX_VOTE_MUTES = 32,
|
2011-02-23 21:39:53 +00:00
|
|
|
};
|
|
|
|
struct CMute
|
|
|
|
{
|
|
|
|
NETADDR m_Addr;
|
|
|
|
int m_Expire;
|
2020-03-30 21:51:58 +00:00
|
|
|
char m_aReason[128];
|
2021-12-18 10:19:35 +00:00
|
|
|
bool m_InitialChatDelay;
|
2011-02-23 21:39:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
CMute m_aMutes[MAX_MUTES];
|
|
|
|
int m_NumMutes;
|
2019-09-04 19:21:40 +00:00
|
|
|
CMute m_aVoteMutes[MAX_VOTE_MUTES];
|
2018-04-19 09:49:18 +00:00
|
|
|
int m_NumVoteMutes;
|
2021-12-18 10:19:35 +00:00
|
|
|
bool TryMute(const NETADDR *pAddr, int Secs, const char *pReason, bool InitialChatDelay);
|
|
|
|
void Mute(const NETADDR *pAddr, int Secs, const char *pDisplayName, const char *pReason = "", bool InitialChatDelay = false);
|
2019-04-12 17:50:02 +00:00
|
|
|
bool TryVoteMute(const NETADDR *pAddr, int Secs);
|
2019-03-19 19:07:33 +00:00
|
|
|
bool VoteMute(const NETADDR *pAddr, int Secs, const char *pDisplayName, int AuthedID);
|
2019-03-19 19:18:11 +00:00
|
|
|
bool VoteUnmute(const NETADDR *pAddr, const char *pDisplayName, int AuthedID);
|
2013-08-09 13:04:20 +00:00
|
|
|
void Whisper(int ClientID, char *pStr);
|
2020-06-12 13:14:56 +00:00
|
|
|
void WhisperID(int ClientID, int VictimID, const char *pMessage);
|
2013-10-18 09:42:35 +00:00
|
|
|
void Converse(int ClientID, char *pStr);
|
2019-02-11 17:52:40 +00:00
|
|
|
bool IsVersionBanned(int Version);
|
2020-05-23 15:55:56 +00:00
|
|
|
void UnlockTeam(int ClientID, int Team);
|
2011-02-23 21:39:53 +00:00
|
|
|
|
2011-01-29 00:59:50 +00:00
|
|
|
public:
|
|
|
|
CLayers *Layers() { return &m_Layers; }
|
2022-06-17 17:54:10 +00:00
|
|
|
CScore *Score() { return m_pScore; }
|
2020-07-01 12:02:47 +00:00
|
|
|
|
2011-01-29 00:59:50 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
VOTE_ENFORCE_NO_ADMIN = VOTE_ENFORCE_YES + 1,
|
2020-07-01 12:02:47 +00:00
|
|
|
VOTE_ENFORCE_YES_ADMIN,
|
|
|
|
|
2020-09-26 19:41:58 +00:00
|
|
|
VOTE_TYPE_UNKNOWN = 0,
|
2020-07-01 12:02:47 +00:00
|
|
|
VOTE_TYPE_OPTION,
|
|
|
|
VOTE_TYPE_KICK,
|
|
|
|
VOTE_TYPE_SPECTATE,
|
2011-01-29 00:59:50 +00:00
|
|
|
};
|
2020-07-01 12:02:47 +00:00
|
|
|
int m_VoteVictim;
|
2011-11-08 11:06:09 +00:00
|
|
|
int m_VoteEnforcer;
|
2020-07-01 12:02:47 +00:00
|
|
|
|
2022-03-08 19:01:26 +00:00
|
|
|
inline bool IsOptionVote() const { return m_VoteType == VOTE_TYPE_OPTION; }
|
|
|
|
inline bool IsKickVote() const { return m_VoteType == VOTE_TYPE_KICK; }
|
|
|
|
inline bool IsSpecVote() const { return m_VoteType == VOTE_TYPE_SPECTATE; }
|
2020-07-01 12:02:47 +00:00
|
|
|
|
2011-02-13 05:35:13 +00:00
|
|
|
void SendRecord(int ClientID);
|
2022-05-17 20:13:44 +00:00
|
|
|
void OnSetAuthed(int ClientID, int Level) override;
|
2011-01-29 00:59:50 +00:00
|
|
|
virtual bool PlayerCollision();
|
|
|
|
virtual bool PlayerHooking();
|
2013-11-13 12:25:26 +00:00
|
|
|
virtual float PlayerJetpack();
|
2011-05-30 20:05:28 +00:00
|
|
|
|
|
|
|
void ResetTuning();
|
2010-05-29 07:25:38 +00:00
|
|
|
};
|
2011-02-02 10:49:19 +00:00
|
|
|
|
2021-06-23 05:05:49 +00:00
|
|
|
inline int64_t CmaskAll() { return -1LL; }
|
|
|
|
inline int64_t CmaskOne(int ClientID) { return 1LL << ClientID; }
|
|
|
|
inline int64_t CmaskUnset(int64_t Mask, int ClientID) { return Mask ^ CmaskOne(ClientID); }
|
|
|
|
inline int64_t CmaskAllExceptOne(int ClientID) { return CmaskUnset(CmaskAll(), ClientID); }
|
|
|
|
inline bool CmaskIsSet(int64_t Mask, int ClientID) { return (Mask & CmaskOne(ClientID)) != 0; }
|
2011-01-29 00:59:50 +00:00
|
|
|
#endif
|