DDraceNetwork Docs
gamecontext.h
Go to the documentation of this file.
1/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
2/* If you are missing that file, acquire a complete release at teeworlds.com. */
3#ifndef GAME_SERVER_GAMECONTEXT_H
4#define GAME_SERVER_GAMECONTEXT_H
5
6#include <engine/console.h>
7#include <engine/server.h>
8
9#include <game/collision.h>
11#include <game/layers.h>
12#include <game/mapbugs.h>
13#include <game/voting.h>
14
15#include "eventhandler.h"
16#include "gameworld.h"
17#include "teehistorian.h"
18
19#include <memory>
20#include <string>
21
22/*
23 Tick
24 Game Context (CGameContext::tick)
25 Game World (GAMEWORLD::tick)
26 Reset world if requested (GAMEWORLD::reset)
27 All entities in the world (ENTITY::tick)
28 All entities in the world (ENTITY::tick_defered)
29 Remove entities marked for deletion (GAMEWORLD::remove_entities)
30 Game Controller (GAMECONTROLLER::tick)
31 All players (CPlayer::tick)
32
33
34 Snap
35 Game Context (CGameContext::snap)
36 Game World (GAMEWORLD::snap)
37 All entities in the world (ENTITY::snap)
38 Game Controller (GAMECONTROLLER::snap)
39 Events handler (EVENT_HANDLER::snap)
40 All players (CPlayer::snap)
41
42*/
43
44enum
45{
46 NUM_TUNEZONES = 256
47};
48
49class CCharacter;
50class IConfigManager;
51class CConfig;
52class CHeap;
53class CPlayer;
54class CScore;
55class CUnpacker;
56class IAntibot;
57class IGameController;
58class IEngine;
59class IStorage;
62
64{
65 CSnapContext(int Version, bool Sixup = false) :
66 m_ClientVersion(Version), m_Sixup(Sixup)
67 {
68 }
69
70 int GetClientVersion() const { return m_ClientVersion; }
71 bool IsSixup() const { return m_Sixup; }
72
73private:
75 bool m_Sixup;
76};
77
79{
93 std::vector<std::string> m_vCensorlist;
94
101
103
104 static void CommandCallback(int ClientId, int FlagMask, const char *pCmd, IConsole::IResult *pResult, void *pUser);
105 static void TeeHistorianWrite(const void *pData, int DataSize, void *pUser);
106
107 static void ConTuneParam(IConsole::IResult *pResult, void *pUserData);
108 static void ConToggleTuneParam(IConsole::IResult *pResult, void *pUserData);
109 static void ConTuneReset(IConsole::IResult *pResult, void *pUserData);
110 static void ConTunes(IConsole::IResult *pResult, void *pUserData);
111 static void ConTuneZone(IConsole::IResult *pResult, void *pUserData);
112 static void ConTuneDumpZone(IConsole::IResult *pResult, void *pUserData);
113 static void ConTuneResetZone(IConsole::IResult *pResult, void *pUserData);
114 static void ConTuneSetZoneMsgEnter(IConsole::IResult *pResult, void *pUserData);
115 static void ConTuneSetZoneMsgLeave(IConsole::IResult *pResult, void *pUserData);
116 static void ConMapbug(IConsole::IResult *pResult, void *pUserData);
117 static void ConSwitchOpen(IConsole::IResult *pResult, void *pUserData);
118 static void ConPause(IConsole::IResult *pResult, void *pUserData);
119 static void ConChangeMap(IConsole::IResult *pResult, void *pUserData);
120 static void ConRandomMap(IConsole::IResult *pResult, void *pUserData);
121 static void ConRandomUnfinishedMap(IConsole::IResult *pResult, void *pUserData);
122 static void ConRestart(IConsole::IResult *pResult, void *pUserData);
123 static void ConBroadcast(IConsole::IResult *pResult, void *pUserData);
124 static void ConSay(IConsole::IResult *pResult, void *pUserData);
125 static void ConSetTeam(IConsole::IResult *pResult, void *pUserData);
126 static void ConSetTeamAll(IConsole::IResult *pResult, void *pUserData);
127 static void ConHotReload(IConsole::IResult *pResult, void *pUserData);
128 static void ConAddVote(IConsole::IResult *pResult, void *pUserData);
129 static void ConRemoveVote(IConsole::IResult *pResult, void *pUserData);
130 static void ConForceVote(IConsole::IResult *pResult, void *pUserData);
131 static void ConClearVotes(IConsole::IResult *pResult, void *pUserData);
132 static void ConAddMapVotes(IConsole::IResult *pResult, void *pUserData);
133 static void ConVote(IConsole::IResult *pResult, void *pUserData);
134 static void ConVotes(IConsole::IResult *pResult, void *pUserData);
135 static void ConVoteNo(IConsole::IResult *pResult, void *pUserData);
136 static void ConDrySave(IConsole::IResult *pResult, void *pUserData);
137 static void ConDumpAntibot(IConsole::IResult *pResult, void *pUserData);
138 static void ConAntibot(IConsole::IResult *pResult, void *pUserData);
139 static void ConchainSpecialMotdupdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
140 static void ConchainSettingUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
141 static void ConDumpLog(IConsole::IResult *pResult, void *pUserData);
142
143 void Construct(int Resetting);
144 void Destruct(int Resetting);
145 void AddVote(const char *pDescription, const char *pCommand);
146 static int MapScan(const char *pName, int IsDir, int DirType, void *pUserData);
147
149 {
151 };
152
154 {
157 };
158
159public:
160 IServer *Server() const { return m_pServer; }
162 CConfig *Config() { return m_pConfig; }
164 IEngine *Engine() { return m_pEngine; }
172
173 CGameContext();
174 CGameContext(int Reset);
176
177 void Clear();
178
181 // keep last input to always apply when none is sent
188
189 // returns last input if available otherwise nulled PlayerInput object
190 // ClientId has to be valid
191 CNetObj_PlayerInput GetLastPlayerInput(int ClientId) const;
192
195
196 // helper functions
197 class CCharacter *GetPlayerChar(int ClientId);
198 bool EmulateBug(int Bug);
199 std::vector<SSwitchers> &Switchers() { return m_World.m_Core.m_vSwitchers; }
200
201 // voting
202 void StartVote(const char *pDesc, const char *pCommand, const char *pReason, const char *pSixupDesc);
203 void EndVote();
204 void SendVoteSet(int ClientId);
205 void SendVoteStatus(int ClientId, int Total, int Yes, int No);
206 void AbortVoteKickOnDisconnect(int ClientId);
207
219 char m_aaZoneEnterMsg[NUM_TUNEZONES][256]; // 0 is used for switching from or to area without tunings
221
222 void CreateAllEntities(bool Initial);
223
225 void DeleteTempfile();
226
227 enum
228 {
236 };
240
241 // helper functions
242 void CreateDamageInd(vec2 Pos, float AngleMod, int Amount, CClientMask Mask = CClientMask().set());
243 void CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamage, int ActivatedTeam, CClientMask Mask = CClientMask().set());
244 void CreateHammerHit(vec2 Pos, CClientMask Mask = CClientMask().set());
245 void CreatePlayerSpawn(vec2 Pos, CClientMask Mask = CClientMask().set());
246 void CreateDeath(vec2 Pos, int ClientId, CClientMask Mask = CClientMask().set());
247 void CreateBirthdayEffect(vec2 Pos, CClientMask Mask = CClientMask().set());
248 void CreateFinishEffect(vec2 Pos, CClientMask Mask = CClientMask().set());
249 void CreateSound(vec2 Pos, int Sound, CClientMask Mask = CClientMask().set());
250 void CreateSoundGlobal(int Sound, int Target = -1) const;
251
252 void SnapSwitchers(int SnappingClient);
253 bool SnapLaserObject(const CSnapContext &Context, int SnapId, const vec2 &To, const vec2 &From, int StartTick, int Owner = -1, int LaserType = -1, int Subtype = -1, int SwitchNumber = -1) const;
254 bool SnapPickup(const CSnapContext &Context, int SnapId, const vec2 &Pos, int Type, int SubType, int SwitchNumber) const;
255
256 enum
257 {
258 FLAG_SIX = 1 << 0,
259 FLAG_SIXUP = 1 << 1,
260 };
261
262 // network
263 void CallVote(int ClientId, const char *pDesc, const char *pCmd, const char *pReason, const char *pChatmsg, const char *pSixupDesc = 0);
264 void SendChatTarget(int To, const char *pText, int VersionFlags = FLAG_SIX | FLAG_SIXUP) const;
265 void SendChatTeam(int Team, const char *pText) const;
266 void SendChat(int ClientId, int Team, const char *pText, int SpamProtectionClientId = -1, int VersionFlags = FLAG_SIX | FLAG_SIXUP);
267 void SendStartWarning(int ClientId, const char *pMessage);
268 void SendEmoticon(int ClientId, int Emoticon, int TargetClientId) const;
269 void SendWeaponPickup(int ClientId, int Weapon) const;
270 void SendMotd(int ClientId) const;
271 void SendSettings(int ClientId) const;
272 void SendBroadcast(const char *pText, int ClientId, bool IsImportant = true);
273
274 void List(int ClientId, const char *pFilter);
275
276 //
277 void CheckPureTuning();
278 void SendTuningParams(int ClientId, int Zone = 0);
279
280 const CVoteOptionServer *GetVoteOption(int Index) const;
281 void ProgressVoteOptions(int ClientId);
282
283 //
284 void LoadMapSettings();
285
286 // engine events
287 void OnInit(const void *pPersistentData) override;
288 void OnConsoleInit() override;
291 void OnMapChange(char *pNewMapName, int MapNameSize) override;
292 void OnShutdown(void *pPersistentData) override;
293
294 void OnTick() override;
295 void OnPreSnap() override;
296 void OnSnap(int ClientId) override;
297 void OnPostSnap() override;
298
299 void UpdatePlayerMaps();
300
301 void *PreProcessMsg(int *pMsgId, CUnpacker *pUnpacker, int ClientId);
302 void CensorMessage(char *pCensoredMessage, const char *pMessage, int Size);
303 void OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId) override;
304 void OnSayNetMessage(const CNetMsg_Cl_Say *pMsg, int ClientId, const CUnpacker *pUnpacker);
305 void OnCallVoteNetMessage(const CNetMsg_Cl_CallVote *pMsg, int ClientId);
306 void OnVoteNetMessage(const CNetMsg_Cl_Vote *pMsg, int ClientId);
307 void OnSetTeamNetMessage(const CNetMsg_Cl_SetTeam *pMsg, int ClientId);
308 void OnIsDDNetLegacyNetMessage(const CNetMsg_Cl_IsDDNetLegacy *pMsg, int ClientId, CUnpacker *pUnpacker);
309 void OnShowOthersLegacyNetMessage(const CNetMsg_Cl_ShowOthersLegacy *pMsg, int ClientId);
310 void OnShowOthersNetMessage(const CNetMsg_Cl_ShowOthers *pMsg, int ClientId);
311 void OnShowDistanceNetMessage(const CNetMsg_Cl_ShowDistance *pMsg, int ClientId);
312 void OnSetSpectatorModeNetMessage(const CNetMsg_Cl_SetSpectatorMode *pMsg, int ClientId);
313 void OnChangeInfoNetMessage(const CNetMsg_Cl_ChangeInfo *pMsg, int ClientId);
314 void OnEmoticonNetMessage(const CNetMsg_Cl_Emoticon *pMsg, int ClientId);
315 void OnKillNetMessage(const CNetMsg_Cl_Kill *pMsg, int ClientId);
316 void OnStartInfoNetMessage(const CNetMsg_Cl_StartInfo *pMsg, int ClientId);
317
318 bool OnClientDataPersist(int ClientId, void *pData) override;
319 void OnClientConnected(int ClientId, void *pData) override;
320 void OnClientEnter(int ClientId) override;
321 void OnClientDrop(int ClientId, const char *pReason) override;
322 void OnClientPrepareInput(int ClientId, void *pInput) override;
323 void OnClientDirectInput(int ClientId, void *pInput) override;
324 void OnClientPredictedInput(int ClientId, void *pInput) override;
325 void OnClientPredictedEarlyInput(int ClientId, void *pInput) override;
326
327 void TeehistorianRecordAntibot(const void *pData, int DataSize) override;
328 void TeehistorianRecordPlayerJoin(int ClientId, bool Sixup) override;
329 void TeehistorianRecordPlayerDrop(int ClientId, const char *pReason) override;
330 void TeehistorianRecordPlayerRejoin(int ClientId) override;
331 void TeehistorianRecordPlayerName(int ClientId, const char *pName) override;
332 void TeehistorianRecordPlayerFinish(int ClientId, int TimeTicks) override;
333 void TeehistorianRecordTeamFinish(int TeamId, int TimeTicks) override;
334
335 bool IsClientReady(int ClientId) const override;
336 bool IsClientPlayer(int ClientId) const override;
337 int PersistentDataSize() const override { return sizeof(CPersistentData); }
338 int PersistentClientDataSize() const override { return sizeof(CPersistentClientData); }
339
340 CUuid GameUuid() const override;
341 const char *GameType() const override;
342 const char *Version() const override;
343 const char *NetVersion() const override;
344
345 // DDRace
346 void OnPreTickTeehistorian() override;
347 bool OnClientDDNetVersionKnown(int ClientId);
348 void FillAntibot(CAntibotRoundData *pData) override;
349 bool ProcessSpamProtection(int ClientId, bool RespectChatInitialDelay = true);
350 int GetDDRaceTeam(int ClientId) const;
351 // Describes the time when the first player joined the server.
354 int GetClientVersion(int ClientId) const;
356 bool PlayerExists(int ClientId) const override { return m_apPlayers[ClientId]; }
357 // Returns true if someone is actively moderating.
358 bool PlayerModerating() const;
359 void ForceVote(int EnforcerId, bool Success);
360
361 // Checks if player can vote and notify them about the reason
362 bool RateLimitPlayerVote(int ClientId);
363 bool RateLimitPlayerMapVote(int ClientId) const;
364
365 void OnUpdatePlayerServerInfo(CJsonStringWriter *pJSonWriter, int Id) override;
366 void ReadCensorList();
367
368 std::shared_ptr<CScoreRandomMapResult> m_SqlRandomMapResult;
369
370private:
371 // starting 1 to make 0 the special value "no client id"
372 uint32_t NextUniqueClientId = 1;
375
376 // DDRace Console Commands
377
378 static void ConKillPlayer(IConsole::IResult *pResult, void *pUserData);
379
380 static void ConNinja(IConsole::IResult *pResult, void *pUserData);
381 static void ConUnNinja(IConsole::IResult *pResult, void *pUserData);
382 static void ConEndlessHook(IConsole::IResult *pResult, void *pUserData);
383 static void ConUnEndlessHook(IConsole::IResult *pResult, void *pUserData);
384 static void ConSolo(IConsole::IResult *pResult, void *pUserData);
385 static void ConUnSolo(IConsole::IResult *pResult, void *pUserData);
386 static void ConFreeze(IConsole::IResult *pResult, void *pUserData);
387 static void ConUnFreeze(IConsole::IResult *pResult, void *pUserData);
388 static void ConDeep(IConsole::IResult *pResult, void *pUserData);
389 static void ConUnDeep(IConsole::IResult *pResult, void *pUserData);
390 static void ConLiveFreeze(IConsole::IResult *pResult, void *pUserData);
391 static void ConUnLiveFreeze(IConsole::IResult *pResult, void *pUserData);
392 static void ConUnSuper(IConsole::IResult *pResult, void *pUserData);
393 static void ConSuper(IConsole::IResult *pResult, void *pUserData);
394 static void ConToggleInvincible(IConsole::IResult *pResult, void *pUserData);
395 static void ConShotgun(IConsole::IResult *pResult, void *pUserData);
396 static void ConGrenade(IConsole::IResult *pResult, void *pUserData);
397 static void ConLaser(IConsole::IResult *pResult, void *pUserData);
398 static void ConJetpack(IConsole::IResult *pResult, void *pUserData);
399 static void ConEndlessJump(IConsole::IResult *pResult, void *pUserData);
400 static void ConSetJumps(IConsole::IResult *pResult, void *pUserData);
401 static void ConWeapons(IConsole::IResult *pResult, void *pUserData);
402 static void ConUnShotgun(IConsole::IResult *pResult, void *pUserData);
403 static void ConUnGrenade(IConsole::IResult *pResult, void *pUserData);
404 static void ConUnLaser(IConsole::IResult *pResult, void *pUserData);
405 static void ConUnJetpack(IConsole::IResult *pResult, void *pUserData);
406 static void ConUnEndlessJump(IConsole::IResult *pResult, void *pUserData);
407 static void ConUnWeapons(IConsole::IResult *pResult, void *pUserData);
408 static void ConAddWeapon(IConsole::IResult *pResult, void *pUserData);
409 static void ConRemoveWeapon(IConsole::IResult *pResult, void *pUserData);
410 void ModifyWeapons(IConsole::IResult *pResult, void *pUserData, int Weapon, bool Remove);
411 void MoveCharacter(int ClientId, int X, int Y, bool Raw = false);
412 static void ConGoLeft(IConsole::IResult *pResult, void *pUserData);
413 static void ConGoRight(IConsole::IResult *pResult, void *pUserData);
414 static void ConGoUp(IConsole::IResult *pResult, void *pUserData);
415 static void ConGoDown(IConsole::IResult *pResult, void *pUserData);
416 static void ConMove(IConsole::IResult *pResult, void *pUserData);
417 static void ConMoveRaw(IConsole::IResult *pResult, void *pUserData);
418
419 static void ConToTeleporter(IConsole::IResult *pResult, void *pUserData);
420 static void ConToCheckTeleporter(IConsole::IResult *pResult, void *pUserData);
421 void Teleport(CCharacter *pChr, vec2 Pos);
422 static void ConTeleport(IConsole::IResult *pResult, void *pUserData);
423
424 static void ConCredits(IConsole::IResult *pResult, void *pUserData);
425 static void ConInfo(IConsole::IResult *pResult, void *pUserData);
426 static void ConHelp(IConsole::IResult *pResult, void *pUserData);
427 static void ConSettings(IConsole::IResult *pResult, void *pUserData);
428 static void ConRules(IConsole::IResult *pResult, void *pUserData);
429 static void ConKill(IConsole::IResult *pResult, void *pUserData);
430 static void ConTogglePause(IConsole::IResult *pResult, void *pUserData);
431 static void ConTogglePauseVoted(IConsole::IResult *pResult, void *pUserData);
432 static void ConToggleSpec(IConsole::IResult *pResult, void *pUserData);
433 static void ConToggleSpecVoted(IConsole::IResult *pResult, void *pUserData);
434 static void ConForcePause(IConsole::IResult *pResult, void *pUserData);
435 static void ConTeamTop5(IConsole::IResult *pResult, void *pUserData);
436 static void ConTop(IConsole::IResult *pResult, void *pUserData);
437 static void ConTimes(IConsole::IResult *pResult, void *pUserData);
438 static void ConPoints(IConsole::IResult *pResult, void *pUserData);
439 static void ConTopPoints(IConsole::IResult *pResult, void *pUserData);
440 static void ConTimeCP(IConsole::IResult *pResult, void *pUserData);
441
442 static void ConDND(IConsole::IResult *pResult, void *pUserData);
443 static void ConWhispers(IConsole::IResult *pResult, void *pUserData);
444 static void ConMapInfo(IConsole::IResult *pResult, void *pUserData);
445 static void ConTimeout(IConsole::IResult *pResult, void *pUserData);
446 static void ConPractice(IConsole::IResult *pResult, void *pUserData);
447 static void ConPracticeCmdList(IConsole::IResult *pResult, void *pUserData);
448 static void ConSwap(IConsole::IResult *pResult, void *pUserData);
449 static void ConSave(IConsole::IResult *pResult, void *pUserData);
450 static void ConLoad(IConsole::IResult *pResult, void *pUserData);
451 static void ConMap(IConsole::IResult *pResult, void *pUserData);
452 static void ConTeamRank(IConsole::IResult *pResult, void *pUserData);
453 static void ConRank(IConsole::IResult *pResult, void *pUserData);
454 static void ConTeam(IConsole::IResult *pResult, void *pUserData);
455 static void ConLock(IConsole::IResult *pResult, void *pUserData);
456 static void ConUnlock(IConsole::IResult *pResult, void *pUserData);
457 static void ConInvite(IConsole::IResult *pResult, void *pUserData);
458 static void ConJoin(IConsole::IResult *pResult, void *pUserData);
459 static void ConTeam0Mode(IConsole::IResult *pResult, void *pUserData);
460 static void ConMe(IConsole::IResult *pResult, void *pUserData);
461 static void ConWhisper(IConsole::IResult *pResult, void *pUserData);
462 static void ConConverse(IConsole::IResult *pResult, void *pUserData);
463 static void ConSetEyeEmote(IConsole::IResult *pResult, void *pUserData);
464 static void ConEyeEmote(IConsole::IResult *pResult, void *pUserData);
465 static void ConShowOthers(IConsole::IResult *pResult, void *pUserData);
466 static void ConShowAll(IConsole::IResult *pResult, void *pUserData);
467 static void ConSpecTeam(IConsole::IResult *pResult, void *pUserData);
468 static void ConNinjaJetpack(IConsole::IResult *pResult, void *pUserData);
469 static void ConSayTime(IConsole::IResult *pResult, void *pUserData);
470 static void ConSayTimeAll(IConsole::IResult *pResult, void *pUserData);
471 static void ConTime(IConsole::IResult *pResult, void *pUserData);
472 static void ConSetTimerType(IConsole::IResult *pResult, void *pUserData);
473 static void ConRescue(IConsole::IResult *pResult, void *pUserData);
474 static void ConRescueMode(IConsole::IResult *pResult, void *pUserData);
475 static void ConTeleTo(IConsole::IResult *pResult, void *pUserData);
476 static void ConTeleXY(IConsole::IResult *pResult, void *pUserData);
477 static void ConTeleCursor(IConsole::IResult *pResult, void *pUserData);
478 static void ConLastTele(IConsole::IResult *pResult, void *pUserData);
479
480 // Chat commands for practice mode
481 static void ConPracticeToTeleporter(IConsole::IResult *pResult, void *pUserData);
482 static void ConPracticeToCheckTeleporter(IConsole::IResult *pResult, void *pUserData);
483 static void ConPracticeUnSolo(IConsole::IResult *pResult, void *pUserData);
484 static void ConPracticeSolo(IConsole::IResult *pResult, void *pUserData);
485 static void ConPracticeUnDeep(IConsole::IResult *pResult, void *pUserData);
486 static void ConPracticeDeep(IConsole::IResult *pResult, void *pUserData);
487 static void ConPracticeUnLiveFreeze(IConsole::IResult *pResult, void *pUserData);
488 static void ConPracticeLiveFreeze(IConsole::IResult *pResult, void *pUserData);
489 static void ConPracticeShotgun(IConsole::IResult *pResult, void *pUserData);
490 static void ConPracticeGrenade(IConsole::IResult *pResult, void *pUserData);
491 static void ConPracticeLaser(IConsole::IResult *pResult, void *pUserData);
492 static void ConPracticeJetpack(IConsole::IResult *pResult, void *pUserData);
493 static void ConPracticeEndlessJump(IConsole::IResult *pResult, void *pUserData);
494 static void ConPracticeSetJumps(IConsole::IResult *pResult, void *pUserData);
495 static void ConPracticeWeapons(IConsole::IResult *pResult, void *pUserData);
496 static void ConPracticeUnShotgun(IConsole::IResult *pResult, void *pUserData);
497 static void ConPracticeUnGrenade(IConsole::IResult *pResult, void *pUserData);
498 static void ConPracticeUnLaser(IConsole::IResult *pResult, void *pUserData);
499 static void ConPracticeUnJetpack(IConsole::IResult *pResult, void *pUserData);
500 static void ConPracticeUnEndlessJump(IConsole::IResult *pResult, void *pUserData);
501 static void ConPracticeUnWeapons(IConsole::IResult *pResult, void *pUserData);
502 static void ConPracticeNinja(IConsole::IResult *pResult, void *pUserData);
503 static void ConPracticeUnNinja(IConsole::IResult *pResult, void *pUserData);
504 static void ConPracticeEndlessHook(IConsole::IResult *pResult, void *pUserData);
505 static void ConPracticeUnEndlessHook(IConsole::IResult *pResult, void *pUserData);
506 static void ConPracticeToggleInvincible(IConsole::IResult *pResult, void *pUserData);
507
508 static void ConPracticeAddWeapon(IConsole::IResult *pResult, void *pUserData);
509 static void ConPracticeRemoveWeapon(IConsole::IResult *pResult, void *pUserData);
510
511 static void ConProtectedKill(IConsole::IResult *pResult, void *pUserData);
512
513 static void ConVoteMute(IConsole::IResult *pResult, void *pUserData);
514 static void ConVoteUnmute(IConsole::IResult *pResult, void *pUserData);
515 static void ConVoteMutes(IConsole::IResult *pResult, void *pUserData);
516 static void ConMute(IConsole::IResult *pResult, void *pUserData);
517 static void ConMuteId(IConsole::IResult *pResult, void *pUserData);
518 static void ConMuteIp(IConsole::IResult *pResult, void *pUserData);
519 static void ConUnmute(IConsole::IResult *pResult, void *pUserData);
520 static void ConUnmuteId(IConsole::IResult *pResult, void *pUserData);
521 static void ConMutes(IConsole::IResult *pResult, void *pUserData);
522 static void ConModerate(IConsole::IResult *pResult, void *pUserData);
523
524 static void ConList(IConsole::IResult *pResult, void *pUserData);
525 static void ConSetDDRTeam(IConsole::IResult *pResult, void *pUserData);
526 static void ConUninvite(IConsole::IResult *pResult, void *pUserData);
527 static void ConFreezeHammer(IConsole::IResult *pResult, void *pUserData);
528 static void ConUnFreezeHammer(IConsole::IResult *pResult, void *pUserData);
529
530 static void ConReloadCensorlist(IConsole::IResult *pResult, void *pUserData);
531 static void ConReloadAnnouncement(IConsole::IResult *pResult, void *pUserData);
532
534
535 enum
536 {
539 };
540 struct CMute
541 {
544 char m_aReason[128];
546 };
547
552 bool TryMute(const NETADDR *pAddr, int Secs, const char *pReason, bool InitialChatDelay);
553 void Mute(const NETADDR *pAddr, int Secs, const char *pDisplayName, const char *pReason = "", bool InitialChatDelay = false);
554 bool TryVoteMute(const NETADDR *pAddr, int Secs, const char *pReason);
555 void VoteMute(const NETADDR *pAddr, int Secs, const char *pReason, const char *pDisplayName, int AuthedId);
556 bool VoteUnmute(const NETADDR *pAddr, const char *pDisplayName, int AuthedId);
557 void Whisper(int ClientId, char *pStr);
558 void WhisperId(int ClientId, int VictimId, const char *pMessage);
559 void Converse(int ClientId, char *pStr);
560 bool IsVersionBanned(int Version);
561 void UnlockTeam(int ClientId, int Team) const;
562 void AttemptJoinTeam(int ClientId, int Team);
563
564 enum
565 {
567 MAX_LOGS = 512,
568 };
569 struct CLog
570 {
571 int64_t m_Timestamp;
573 char m_aDescription[128];
577 };
580
581 void LogEvent(const char *Description, int ClientId);
582
583public:
584 CLayers *Layers() { return &m_Layers; }
585 CScore *Score() { return m_pScore; }
586
587 enum
588 {
593 };
595
596 inline bool IsOptionVote() const { return m_VoteType == VOTE_TYPE_OPTION; }
597 inline bool IsKickVote() const { return m_VoteType == VOTE_TYPE_KICK; }
598 inline bool IsSpecVote() const { return m_VoteType == VOTE_TYPE_SPECTATE; }
599
600 void SendRecord(int ClientId);
601 void OnSetAuthed(int ClientId, int Level) override;
602
603 void ResetTuning();
604};
605
606#endif
Definition: character.h:30
int Team()
Definition: character.cpp:631
bool Remove()
Definition: collision.h:34
Definition: config.h:23
Definition: eventhandler.h:11
Definition: gamecontext.h:79
static void ConAntibot(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:932
static void ConUnNinja(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:108
static void ConLaser(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:266
void CreatePlayerSpawn(vec2 Pos, CClientMask Mask=CClientMask().set())
Definition: gamecontext.cpp:349
static void ConTuneZone(IConsole::IResult *pResult, void *pUserData)
Definition: gamecontext.cpp:2967
int m_NumVoteMutes
Definition: gamecontext.h:551
void CreateFinishEffect(vec2 Pos, CClientMask Mask=CClientMask().set())
Definition: gamecontext.cpp:380
static void ConDumpLog(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:938
static void ConGoRight(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:25
static void ConRules(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:263
static void ConMutes(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:761
void OnClientDrop(int ClientId, const char *pReason) override
Definition: gamecontext.cpp:1705
static void ConMap(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:529
void OnStartInfoNetMessage(const CNetMsg_Cl_StartInfo *pMsg, int ClientId)
Definition: gamecontext.cpp:2821
static void ConPracticeGrenade(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:2149
static void ConSetJumps(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:288
CTeeHistorian m_TeeHistorian
Definition: gamecontext.h:96
void OnTick() override
Definition: gamecontext.cpp:1013
bool SnapPickup(const CSnapContext &Context, int SnapId, const vec2 &Pos, int Type, int SubType, int SwitchNumber) const
Definition: gamecontext.cpp:512
CHeap * m_pVoteOptionHeap
Definition: gamecontext.h:237
static void ConTogglePause(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:387
void TeehistorianRecordPlayerJoin(int ClientId, bool Sixup) override
Definition: gamecontext.cpp:1758
void LogEvent(const char *Description, int ClientId)
Definition: ddracecommands.cpp:971
static void ConTimeCP(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:2341
void SendChatTarget(int To, const char *pText, int VersionFlags=FLAG_SIX|FLAG_SIXUP) const
Definition: gamecontext.cpp:582
static void ConTeam(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:1243
static void ConPracticeUnGrenade(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:2198
static void ConEyeEmote(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:1380
IConsole * m_pConsole
Definition: gamecontext.h:83
static void ConForcePause(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:468
void AttemptJoinTeam(int ClientId, int Team)
Definition: ddracechat.cpp:1020
void Teleport(CCharacter *pChr, vec2 Pos)
Definition: ddracecommands.cpp:383
void ForceVote(int EnforcerId, bool Success)
Definition: gamecontext.cpp:4838
static void ConUnmuteId(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:733
static void ConGrenade(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:260
int64_t m_VoteCloseTime
Definition: gamecontext.h:210
static void ConToggleInvincible(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:163
void DeleteTempfile()
Definition: gamecontext.cpp:4144
static void ConMove(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:55
void OnMapChange(char *pNewMapName, int MapNameSize) override
Definition: gamecontext.cpp:4153
static void ConchainSpecialMotdupdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
Definition: gamecontext.cpp:3595
static void ConPause(IConsole::IResult *pResult, void *pUserData)
Definition: gamecontext.cpp:3104
static void ConGoLeft(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:15
static void ConNinjaJetpack(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:1443
static void ConSetEyeEmote(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:1346
int m_NumMutes
Definition: gamecontext.h:549
~CGameContext()
Definition: gamecontext.cpp:163
IAntibot * Antibot()
Definition: gamecontext.h:169
IStorage * m_pStorage
Definition: gamecontext.h:85
void SendMotd(int ClientId) const
Definition: gamecontext.cpp:727
CScore * m_pScore
Definition: gamecontext.h:374
static void ConWhispers(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:515
static void ConUnEndlessJump(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:328
void OnSayNetMessage(const CNetMsg_Cl_Say *pMsg, int ClientId, const CUnpacker *pUnpacker)
Definition: gamecontext.cpp:2093
static void ConPracticeWeapons(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:2184
void OnIsDDNetLegacyNetMessage(const CNetMsg_Cl_IsDDNetLegacy *pMsg, int ClientId, CUnpacker *pUnpacker)
Definition: gamecontext.cpp:2541
void SendTuningParams(int ClientId, int Zone=0)
Definition: gamecontext.cpp:919
static void ConPracticeToTeleporter(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:2005
static void ConDumpAntibot(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:926
bool IsVersionBanned(int Version)
Definition: gamecontext.cpp:4767
CVoteOptionServer * m_pVoteOptionLast
Definition: gamecontext.h:239
bool IsKickVote() const
Definition: gamecontext.h:597
int64_t m_LastMapVote
Definition: gamecontext.h:353
CNetObj_PlayerInput m_aLastPlayerInput[MAX_CLIENTS]
Definition: gamecontext.h:182
static void ConPracticeEndlessJump(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:2170
static void ConPracticeJetpack(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:2163
static void ConPracticeLiveFreeze(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:2132
void ModifyWeapons(IConsole::IResult *pResult, void *pUserData, int Weapon, bool Remove)
Definition: ddracecommands.cpp:354
CLayers m_Layers
Definition: gamecontext.h:87
void CreateDamageInd(vec2 Pos, float AngleMod, int Amount, CClientMask Mask=CClientMask().set())
Definition: gamecontext.cpp:262
CGameWorld m_World
Definition: gamecontext.h:194
static void ConUninvite(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:836
void VoteMute(const NETADDR *pAddr, int Secs, const char *pReason, const char *pDisplayName, int AuthedId)
Definition: ddracecommands.cpp:510
void OnSetTeamNetMessage(const CNetMsg_Cl_SetTeam *pMsg, int ClientId)
Definition: gamecontext.cpp:2494
char m_aVoteCommand[VOTE_CMD_LENGTH]
Definition: gamecontext.h:215
static void ConPracticeUnEndlessHook(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:2254
bool m_aPlayerHasInput[MAX_CLIENTS]
Definition: gamecontext.h:183
CMute m_aVoteMutes[MAX_VOTE_MUTES]
Definition: gamecontext.h:550
static void ConPracticeSetJumps(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:2177
static void ConDrySave(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:886
void RegisterDDRaceCommands()
Definition: gamecontext.cpp:3669
void OnClientPredictedInput(int ClientId, void *pInput) override
Definition: gamecontext.cpp:1336
CTuningParams m_Tuning
Definition: gamecontext.h:91
CCollision * Collision()
Definition: gamecontext.h:166
static void ConToggleSpecVoted(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:382
static void ConMuteId(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:679
static void ConUnWeapons(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:336
void SendWeaponPickup(int ClientId, int Weapon) const
Definition: gamecontext.cpp:720
static void ConUnJetpack(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:320
CEventHandler m_Events
Definition: gamecontext.h:179
void OnInit(const void *pPersistentData) override
Definition: gamecontext.cpp:3838
static void ConDND(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:501
void ResetTuning()
Definition: gamecontext.cpp:4551
void OnPostSnap() override
Definition: gamecontext.cpp:4371
static void ConLoad(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:878
void ReadCensorList()
Definition: gamecontext.cpp:5000
void CensorMessage(char *pCensoredMessage, const char *pMessage, int Size)
Definition: gamecontext.cpp:2006
static void ConVotes(IConsole::IResult *pResult, void *pUserData)
Definition: gamecontext.cpp:3563
bool OnClientDDNetVersionKnown(int ClientId)
Definition: gamecontext.cpp:1806
static void ConGoDown(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:35
void TeehistorianRecordPlayerRejoin(int ClientId) override
Definition: gamecontext.cpp:1774
static void ConJoin(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:1286
static void ConPracticeSolo(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:2073
CClientMask ClientsMaskExcludeClientVersionAndHigher(int Version) const
Definition: gamecontext.cpp:4821
void CreateDeath(vec2 Pos, int ClientId, CClientMask Mask=CClientMask().set())
Definition: gamecontext.cpp:359
void OnKillNetMessage(const CNetMsg_Cl_Kill *pMsg, int ClientId)
Definition: gamecontext.cpp:2788
void OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId) override
Definition: gamecontext.cpp:2028
IServer * m_pServer
Definition: gamecontext.h:80
static void ConPracticeDeep(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:2112
void UpdatePlayerMaps()
Definition: gamecontext.cpp:4377
CLog m_aLogs[MAX_LOGS]
Definition: gamecontext.h:578
static void ConPracticeLaser(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:2156
static void ConPracticeToCheckTeleporter(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:2025
CUuid GameUuid() const override
Definition: gamecontext.cpp:4448
static void ConConverse(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:1336
static void ConMapInfo(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:558
static void ConToTeleporter(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:391
static void ConWeapons(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:296
CSaveTee * m_apSavedTees[MAX_CLIENTS]
Definition: gamecontext.h:185
bool EmulateBug(int Bug)
Definition: gamecontext.cpp:215
static void ConHotReload(IConsole::IResult *pResult, void *pUserData)
Definition: gamecontext.cpp:3211
static void ConClearVotes(IConsole::IResult *pResult, void *pUserData)
Definition: gamecontext.cpp:3447
void SendRecord(int ClientId)
Definition: gamecontext.cpp:4481
static void ConUnGrenade(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:308
static void ConPracticeUnSolo(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:2045
static void ConUnLaser(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:314
void OnPreTickTeehistorian() override
Definition: gamecontext.cpp:995
void OnClientPredictedEarlyInput(int ClientId, void *pInput) override
Definition: gamecontext.cpp:1353
static void ConTeam0Mode(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:1163
static void ConPracticeRemoveWeapon(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:2275
void MoveCharacter(int ClientId, int X, int Y, bool Raw=false)
Definition: ddracecommands.cpp:73
bool IsSpecVote() const
Definition: gamecontext.h:598
static void ConTunes(IConsole::IResult *pResult, void *pUserData)
Definition: gamecontext.cpp:2954
static void ConWhisper(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:1341
CMute m_aMutes[MAX_MUTES]
Definition: gamecontext.h:548
bool m_Resetting
Definition: gamecontext.h:102
void SendChat(int ClientId, int Team, const char *pText, int SpamProtectionClientId=-1, int VersionFlags=FLAG_SIX|FLAG_SIXUP)
Definition: gamecontext.cpp:620
bool VoteUnmute(const NETADDR *pAddr, const char *pDisplayName, int AuthedId)
Definition: ddracecommands.cpp:527
static void ConUnDeep(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:221
static void ConPracticeUnNinja(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:2240
static void ConSetTimerType(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:1620
void OnSnap(int ClientId) override
Definition: gamecontext.cpp:4343
void OnConsoleInit() override
Definition: gamecontext.cpp:3615
void OnClientPrepareInput(int ClientId, void *pInput) override
Definition: gamecontext.cpp:1317
static void ConReloadCensorlist(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:914
void * PreProcessMsg(int *pMsgId, CUnpacker *pUnpacker, int ClientId)
Definition: gamecontext.cpp:1856
void Destruct(int Resetting)
Definition: gamecontext.cpp:127
static void ConRank(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:917
void ProgressVoteOptions(int ClientId)
Definition: gamecontext.cpp:1397
static void ConRemoveWeapon(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:348
static void ConBroadcast(IConsole::IResult *pResult, void *pUserData)
Definition: gamecontext.cpp:3146
static void ConPracticeNinja(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:2233
int GetDDRaceTeam(int ClientId) const
Definition: gamecontext.cpp:4546
void OnCallVoteNetMessage(const CNetMsg_Cl_CallVote *pMsg, int ClientId)
Definition: gamecontext.cpp:2212
void TeehistorianRecordPlayerDrop(int ClientId, const char *pReason) override
Definition: gamecontext.cpp:1766
static void ConRandomUnfinishedMap(IConsole::IResult *pResult, void *pUserData)
Definition: gamecontext.cpp:3126
void AddVote(const char *pDescription, const char *pCommand)
Definition: gamecontext.cpp:3251
CUuid m_GameUuid
Definition: gamecontext.h:98
static void ConAddVote(IConsole::IResult *pResult, void *pUserData)
Definition: gamecontext.cpp:3242
static void ConTuneSetZoneMsgLeave(IConsole::IResult *pResult, void *pUserData)
Definition: gamecontext.cpp:3047
static void ConPracticeEndlessHook(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:2247
void OnShowOthersLegacyNetMessage(const CNetMsg_Cl_ShowOthersLegacy *pMsg, int ClientId)
Definition: gamecontext.cpp:2557
void TeehistorianRecordTeamFinish(int TeamId, int TimeTicks) override
Definition: gamecontext.cpp:1798
static void ConPracticeShotgun(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:2142
static void ConVoteMute(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:600
static void ConTimes(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:462
bool TryMute(const NETADDR *pAddr, int Secs, const char *pReason, bool InitialChatDelay)
Definition: ddracecommands.cpp:548
void SnapSwitchers(int SnappingClient)
Definition: gamecontext.cpp:423
static void ConPracticeUnDeep(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:2101
static void ConSetTeam(IConsole::IResult *pResult, void *pUserData)
Definition: gamecontext.cpp:3177
bool RateLimitPlayerVote(int ClientId)
Definition: gamecontext.cpp:4854
void CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamage, int ActivatedTeam, CClientMask Mask=CClientMask().set())
Definition: gamecontext.cpp:291
void SendStartWarning(int ClientId, const char *pMessage)
Definition: gamecontext.cpp:702
CNetObj_PlayerInput GetLastPlayerInput(int ClientId) const
Definition: gamecontext.cpp:202
IEngine * Engine()
Definition: gamecontext.h:164
static void ConUnFreeze(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:201
static void ConFreezeHammer(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:844
ASYNCIO * m_pTeeHistorianFile
Definition: gamecontext.h:97
CPlayer * m_apPlayers[MAX_CLIENTS]
Definition: gamecontext.h:180
static void ConSpecTeam(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:1509
static void ConLock(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:938
static void ConSwap(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:735
static void ConTuneParam(IConsole::IResult *pResult, void *pUserData)
Definition: gamecontext.cpp:2869
int PersistentDataSize() const override
Definition: gamecontext.h:337
void CreateSoundGlobal(int Sound, int Target=-1) const
Definition: gamecontext.cpp:405
const char * Version() const override
Definition: gamecontext.cpp:4450
CSaveTee * m_apSavedTeleTees[MAX_CLIENTS]
Definition: gamecontext.h:186
static void ConInfo(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:66
static void ConSetTeamAll(IConsole::IResult *pResult, void *pUserData)
Definition: gamecontext.cpp:3197
static void ConchainSettingUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
Definition: gamecontext.cpp:3605
static void ConUnlock(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:987
IConfigManager * m_pConfigManager
Definition: gamecontext.h:81
static void ConPracticeCmdList(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:711
int m_VoteEnforce
Definition: gamecontext.h:218
static void ConVote(IConsole::IResult *pResult, void *pUserData)
Definition: gamecontext.cpp:3553
CScore * Score()
Definition: gamecontext.h:585
IServer * Server() const
Definition: gamecontext.h:160
void TeehistorianRecordPlayerFinish(int ClientId, int TimeTicks) override
Definition: gamecontext.cpp:1790
static void ConGoUp(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:45
void StartVote(const char *pDesc, const char *pCommand, const char *pReason, const char *pSixupDesc)
Definition: gamecontext.cpp:778
void CreateAllEntities(bool Initial)
Definition: gamecontext.cpp:4043
void LoadMapSettings()
Definition: gamecontext.cpp:4307
static void ConSetDDRTeam(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:810
CTuningParams m_aTuningList[NUM_TUNEZONES]
Definition: gamecontext.h:92
void SendVoteSet(int ClientId)
Definition: gamecontext.cpp:807
static void ConTuneResetZone(IConsole::IResult *pResult, void *pUserData)
Definition: gamecontext.cpp:3007
void RegisterChatCommands()
Definition: gamecontext.cpp:3738
void Clear()
Definition: gamecontext.cpp:168
const char * GameType() const override
Definition: gamecontext.cpp:4449
static void ConVoteMutes(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:643
int m_aTeamMapping[MAX_CLIENTS]
Definition: gamecontext.h:187
bool ProcessSpamProtection(int ClientId, bool RespectChatInitialDelay=true)
Definition: gamecontext.cpp:4494
CConfig * Config()
Definition: gamecontext.h:162
CTuningParams * TuningList()
Definition: gamecontext.h:168
static void ConPoints(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:2301
CConfig * m_pConfig
Definition: gamecontext.h:82
static void ConReloadAnnouncement(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:920
static void ConPracticeToggleInvincible(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:2261
static void ConTeamTop5(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:397
static void ConNinja(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:102
CCollision m_Collision
Definition: gamecontext.h:88
static void ConUnFreezeHammer(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:862
CMapBugs m_MapBugs
Definition: gamecontext.h:99
static void ConJetpack(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:272
void OnClientDirectInput(int ClientId, void *pInput) override
Definition: gamecontext.cpp:1324
CCharacter * GetPracticeCharacter(IConsole::IResult *pResult)
Definition: ddracechat.cpp:1984
bool IsOptionVote() const
Definition: gamecontext.h:596
void CallVote(int ClientId, const char *pDesc, const char *pCmd, const char *pReason, const char *pChatmsg, const char *pSixupDesc=0)
Definition: gamecontext.cpp:559
bool m_VoteUpdate
Definition: gamecontext.h:211
static void ConTogglePauseVoted(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:392
CGameContext()
Definition: gamecontext.cpp:153
void WhisperId(int ClientId, int VictimId, const char *pMessage)
Definition: gamecontext.cpp:4673
void OnShowDistanceNetMessage(const CNetMsg_Cl_ShowDistance *pMsg, int ClientId)
Definition: gamecontext.cpp:2575
int PersistentClientDataSize() const override
Definition: gamecontext.h:338
static void ConMuteIp(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:700
static void ConPracticeUnLaser(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:2205
IConfigManager * ConfigManager() const
Definition: gamecontext.h:161
char m_aSixupVoteDescription[VOTE_DESC_LENGTH]
Definition: gamecontext.h:214
IAntibot * m_pAntibot
Definition: gamecontext.h:86
static void ConAddWeapon(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:342
static void ConRestart(IConsole::IResult *pResult, void *pUserData)
Definition: gamecontext.cpp:3137
static void ConTuneSetZoneMsgEnter(IConsole::IResult *pResult, void *pUserData)
Definition: gamecontext.cpp:3034
void CreateSound(vec2 Pos, int Sound, CClientMask Mask=CClientMask().set())
Definition: gamecontext.cpp:390
void Converse(int ClientId, char *pStr)
Definition: gamecontext.cpp:4750
static void ConSayTimeAll(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:1573
char m_aVoteDescription[VOTE_DESC_LENGTH]
Definition: gamecontext.h:213
const char * NetVersion() const override
Definition: gamecontext.cpp:4451
static void ConToCheckTeleporter(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:407
std::vector< std::string > m_vCensorlist
Definition: gamecontext.h:93
void SendVoteStatus(int ClientId, int Total, int Yes, int No)
Definition: gamecontext.cpp:867
static void ConMute(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:669
static void ConShowOthers(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:1458
uint32_t NextUniqueClientId
Definition: gamecontext.h:372
bool PlayerExists(int ClientId) const override
Definition: gamecontext.h:356
void OnShowOthersNetMessage(const CNetMsg_Cl_ShowOthers *pMsg, int ClientId)
Definition: gamecontext.cpp:2566
static void ConModerate(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:787
static void ConShowAll(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:1481
void AbortVoteKickOnDisconnect(int ClientId)
Definition: gamecontext.cpp:893
static void ConTeleXY(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:1825
int64_t m_NonEmptySince
Definition: gamecontext.h:352
static void ConSayTime(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:1530
@ FLAG_SIXUP
Definition: gamecontext.h:259
@ FLAG_SIX
Definition: gamecontext.h:258
void OnClientConnected(int ClientId, void *pData) override
Definition: gamecontext.cpp:1662
static void ConForceVote(IConsole::IResult *pResult, void *pUserData)
Definition: gamecontext.cpp:3377
static void ConEndlessHook(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:114
static void ConVoteNo(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:879
void OnPreSnap() override
Definition: gamecontext.cpp:4370
void OnUpdatePlayerServerInfo(CJsonStringWriter *pJSonWriter, int Id) override
Definition: gamecontext.cpp:4941
static void ConRescueMode(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:1707
protocol7::CNetObjHandler m_NetObjHandler7
Definition: gamecontext.h:89
static void ConLastTele(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:1956
static void ConKill(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:454
static void CommandCallback(int ClientId, int FlagMask, const char *pCmd, IConsole::IResult *pResult, void *pUser)
Definition: gamecontext.cpp:193
IGameController * m_pController
Definition: gamecontext.h:193
IConsole * Console()
Definition: gamecontext.h:163
static void ConPracticeUnWeapons(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:2226
std::shared_ptr< CScoreRandomMapResult > m_SqlRandomMapResult
Definition: gamecontext.h:368
bool RateLimitPlayerMapVote(int ClientId) const
Definition: gamecontext.cpp:4928
void OnClientEnter(int ClientId) override
Definition: gamecontext.cpp:1483
static void ConInvite(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:1099
static void ConUnSuper(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:151
CLayers * Layers()
Definition: gamecontext.h:584
static int MapScan(const char *pName, int IsDir, int DirType, void *pUserData)
Definition: gamecontext.cpp:3537
static void ConPracticeUnJetpack(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:2212
static void ConLiveFreeze(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:234
void OnChangeInfoNetMessage(const CNetMsg_Cl_ChangeInfo *pMsg, int ClientId)
Definition: gamecontext.cpp:2603
void CreateBirthdayEffect(vec2 Pos, CClientMask Mask=CClientMask().set())
Definition: gamecontext.cpp:370
void EndVote()
Definition: gamecontext.cpp:801
void TeehistorianRecordPlayerName(int ClientId, const char *pName) override
Definition: gamecontext.cpp:1782
int m_VotePos
Definition: gamecontext.h:212
bool m_TeeHistorianActive
Definition: gamecontext.h:95
static void ConToggleTuneParam(IConsole::IResult *pResult, void *pUserData)
Definition: gamecontext.cpp:2903
@ VOTE_ENFORCE_NO
Definition: gamecontext.h:230
@ VOTE_ENFORCE_NO_ADMIN
Definition: gamecontext.h:232
@ VOTE_ENFORCE_YES_ADMIN
Definition: gamecontext.h:233
@ VOTE_ENFORCE_UNKNOWN
Definition: gamecontext.h:229
@ VOTE_ENFORCE_CANCEL
Definition: gamecontext.h:235
@ VOTE_ENFORCE_ABORT
Definition: gamecontext.h:234
@ VOTE_ENFORCE_YES
Definition: gamecontext.h:231
char m_aDeleteTempfile[128]
Definition: gamecontext.h:224
void Whisper(int ClientId, char *pStr)
Definition: gamecontext.cpp:4568
static void ConPracticeUnLiveFreeze(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:2122
static void ConTopPoints(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:2322
char m_aaZoneLeaveMsg[NUM_TUNEZONES][256]
Definition: gamecontext.h:220
static void ConTeleTo(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:1764
void Construct(int Resetting)
Definition: gamecontext.cpp:77
static void ConPractice(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:614
static void ConSuper(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:138
static void ConUnmute(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:714
static void ConTeamRank(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:896
int m_VoteType
Definition: gamecontext.h:209
static void ConRandomMap(IConsole::IResult *pResult, void *pUserData)
Definition: gamecontext.cpp:3117
static void ConUnEndlessHook(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:126
IStorage * Storage()
Definition: gamecontext.h:165
static void ConMapbug(IConsole::IResult *pResult, void *pUserData)
Definition: gamecontext.cpp:3060
static void ConShotgun(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:254
static void ConToggleSpec(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:377
static void ConSwitchOpen(IConsole::IResult *pResult, void *pUserData)
Definition: gamecontext.cpp:3090
static void ConDeep(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:211
int m_VoteVictim
Definition: gamecontext.h:594
CPrng m_Prng
Definition: gamecontext.h:100
CSaveTeam * m_apSavedTeams[MAX_CLIENTS]
Definition: gamecontext.h:184
void OnVoteNetMessage(const CNetMsg_Cl_Vote *pMsg, int ClientId)
Definition: gamecontext.cpp:2461
static void ConSay(IConsole::IResult *pResult, void *pUserData)
Definition: gamecontext.cpp:3171
IEngine * m_pEngine
Definition: gamecontext.h:84
void CreateHammerHit(vec2 Pos, CClientMask Mask=CClientMask().set())
Definition: gamecontext.cpp:281
void SendBroadcast(const char *pText, int ClientId, bool IsImportant=true)
Definition: gamecontext.cpp:746
void List(int ClientId, const char *pFilter)
Definition: gamecontext.cpp:4775
bool m_VoteWillPass
Definition: gamecontext.h:373
bool TryVoteMute(const NETADDR *pAddr, int Secs, const char *pReason)
Definition: ddracecommands.cpp:483
int m_VoteCreator
Definition: gamecontext.h:208
int m_NumVoteOptions
Definition: gamecontext.h:217
CTuningParams * Tuning()
Definition: gamecontext.h:167
void CheckPureTuning()
Definition: gamecontext.cpp:900
void OnSetAuthed(int ClientId, int Level) override
Definition: gamecontext.cpp:4455
static void ConTimeout(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:574
void TeehistorianRecordAntibot(const void *pData, int DataSize) override
Definition: gamecontext.cpp:1750
static void ConPracticeUnShotgun(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:2191
void SendChatTeam(int Team, const char *pText) const
Definition: gamecontext.cpp:613
static void ConTeleCursor(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:1903
bool SnapLaserObject(const CSnapContext &Context, int SnapId, const vec2 &To, const vec2 &From, int StartTick, int Owner=-1, int LaserType=-1, int Subtype=-1, int SwitchNumber=-1) const
Definition: gamecontext.cpp:477
@ MAX_VOTE_MUTES
Definition: gamecontext.h:538
@ MAX_MUTES
Definition: gamecontext.h:537
static void ConSave(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:859
void SendSettings(int ClientId) const
Definition: gamecontext.cpp:734
const CVoteOptionServer * GetVoteOption(int Index) const
Definition: gamecontext.cpp:1384
static void ConTeleport(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:424
static void ConPracticeUnEndlessJump(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:2219
void SendEmoticon(int ClientId, int Emoticon, int TargetClientId) const
Definition: gamecontext.cpp:712
static void ConTuneDumpZone(IConsole::IResult *pResult, void *pUserData)
Definition: gamecontext.cpp:2990
int GetClientVersion(int ClientId) const
Definition: gamecontext.cpp:4816
static void ConProtectedKill(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:2282
@ MAX_LOG_SECONDS
Definition: gamecontext.h:566
@ MAX_LOGS
Definition: gamecontext.h:567
static void ConKillPlayer(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:84
static void ConUnSolo(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:181
bool TeeHistorianActive() const
Definition: gamecontext.h:171
void UnlockTeam(int ClientId, int Team) const
Definition: ddracechat.cpp:1011
static void ConTop(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:443
@ VOTE_TYPE_SPECTATE
Definition: gamecontext.h:592
@ VOTE_TYPE_KICK
Definition: gamecontext.h:591
@ VOTE_TYPE_UNKNOWN
Definition: gamecontext.h:589
@ VOTE_TYPE_OPTION
Definition: gamecontext.h:590
static void ConMe(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:1316
static void ConTime(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:1597
static void ConFreeze(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:191
static void ConEndlessJump(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:280
void Mute(const NETADDR *pAddr, int Secs, const char *pDisplayName, const char *pReason="", bool InitialChatDelay=false)
Definition: ddracecommands.cpp:581
void OnShutdown(void *pPersistentData) override
Definition: gamecontext.cpp:4270
CNetObjHandler m_NetObjHandler
Definition: gamecontext.h:90
static void ConVoteUnmute(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:619
static void ConTuneReset(IConsole::IResult *pResult, void *pUserData)
Definition: gamecontext.cpp:2927
static void ConMoveRaw(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:64
CTeeHistorian * TeeHistorian()
Definition: gamecontext.h:170
static void ConChangeMap(IConsole::IResult *pResult, void *pUserData)
Definition: gamecontext.cpp:3111
bool OnClientDataPersist(int ClientId, void *pData) override
Definition: gamecontext.cpp:1650
static void ConRemoveVote(IConsole::IResult *pResult, void *pUserData)
Definition: gamecontext.cpp:3308
static void ConCredits(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:18
static void ConList(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:85
char m_aVoteReason[VOTE_REASON_LENGTH]
Definition: gamecontext.h:216
int m_LatestLog
Definition: gamecontext.h:579
static void ConSolo(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:171
char m_aaZoneEnterMsg[NUM_TUNEZONES][256]
Definition: gamecontext.h:219
static void ConAddMapVotes(IConsole::IResult *pResult, void *pUserData)
Definition: gamecontext.cpp:3483
static void ConRescue(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:1672
bool IsClientReady(int ClientId) const override
Definition: gamecontext.cpp:4438
std::vector< SSwitchers > & Switchers()
Definition: gamecontext.h:199
static void ConUnShotgun(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:302
static void ConHelp(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:99
CVoteOptionServer * m_pVoteOptionFirst
Definition: gamecontext.h:238
static void ConUnLiveFreeze(IConsole::IResult *pResult, void *pUserData)
Definition: ddracecommands.cpp:244
static void ConPracticeAddWeapon(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:2268
bool IsClientPlayer(int ClientId) const override
Definition: gamecontext.cpp:4443
static void TeeHistorianWrite(const void *pData, int DataSize, void *pUser)
Definition: gamecontext.cpp:187
bool PlayerModerating() const
Definition: gamecontext.cpp:4833
void OnEmoticonNetMessage(const CNetMsg_Cl_Emoticon *pMsg, int ClientId)
Definition: gamecontext.cpp:2709
void FillAntibot(CAntibotRoundData *pData) override
Definition: gamecontext.cpp:220
class CCharacter * GetPlayerChar(int ClientId)
Definition: gamecontext.cpp:208
static void ConSettings(IConsole::IResult *pResult, void *pUserData)
Definition: ddracechat.cpp:138
void OnSetSpectatorModeNetMessage(const CNetMsg_Cl_SetSpectatorMode *pMsg, int ClientId)
Definition: gamecontext.cpp:2581
Definition: gameworld.h:17
CWorldCore m_Core
Definition: gameworld.h:34
Definition: memheap.h:11
Definition: jsonwriter.h:105
Definition: layers.h:13
Definition: mapbugs.h:22
Definition: protocol.h:1261
Definition: player.h:33
Definition: prng.h:7
Definition: save.h:152
Definition: save.h:34
Definition: score.h:15
Definition: teehistorian.h:16
Definition: gamecore.h:41
Definition: packer.h:32
std::vector< SSwitchers > m_vSwitchers
Definition: gamecore.h:172
Definition: antibot.h:7
Definition: config.h:9
Definition: console.h:45
Definition: console.h:18
void(* FCommandCallback)(IResult *pResult, void *pUserData)
Definition: console.h:92
Definition: engine.h:15
Definition: gamecontroller.h:19
Definition: server.h:296
Definition: server.h:30
Definition: storage.h:20
Definition: protocol7.h:1229
std::bitset< MAX_CLIENTS > CClientMask
Definition: protocol.h:132
@ MAX_CLIENTS
Definition: protocol.h:88
@ MAX_NAME_LENGTH
Definition: protocol.h:97
@ NUM_TUNEZONES
Definition: gamecontext.h:46
Definition: system.cpp:452
Definition: antibot_data.h:98
Definition: gamecontext.h:570
char m_aClientName[MAX_NAME_LENGTH]
Definition: gamecontext.h:575
char m_aDescription[128]
Definition: gamecontext.h:573
bool m_FromServer
Definition: gamecontext.h:572
int64_t m_Timestamp
Definition: gamecontext.h:571
int m_ClientVersion
Definition: gamecontext.h:574
char m_aClientAddrStr[NETADDR_MAXSTRSIZE]
Definition: gamecontext.h:576
Definition: gamecontext.h:541
int m_Expire
Definition: gamecontext.h:543
char m_aReason[128]
Definition: gamecontext.h:544
NETADDR m_Addr
Definition: gamecontext.h:542
bool m_InitialChatDelay
Definition: gamecontext.h:545
Definition: gamecontext.h:154
bool m_IsSpectator
Definition: gamecontext.h:155
bool m_IsAfk
Definition: gamecontext.h:156
Definition: gamecontext.h:149
CUuid m_PrevGameUuid
Definition: gamecontext.h:150
Definition: protocol.h:1025
Definition: protocol.h:967
Definition: protocol.h:1001
Definition: protocol.h:1041
Definition: protocol.h:991
Definition: protocol.h:905
Definition: protocol.h:931
Definition: protocol.h:919
Definition: protocol.h:1125
Definition: protocol.h:1101
Definition: protocol.h:1139
Definition: protocol.h:943
Definition: protocol.h:1013
Definition: protocol.h:360
Definition: scoreworker.h:104
Definition: gamecontext.h:64
bool m_Sixup
Definition: gamecontext.h:75
int GetClientVersion() const
Definition: gamecontext.h:70
bool IsSixup() const
Definition: gamecontext.h:71
CSnapContext(int Version, bool Sixup=false)
Definition: gamecontext.h:65
int m_ClientVersion
Definition: gamecontext.h:74
Definition: uuid_manager.h:17
Definition: voting.h:23
Definition: types.h:67
@ NETADDR_MAXSTRSIZE
Definition: types.h:45
@ VOTE_DESC_LENGTH
Definition: voting.h:8
@ VOTE_CMD_LENGTH
Definition: voting.h:9
@ VOTE_REASON_LENGTH
Definition: voting.h:10