DDraceNetwork Docs
teehistorian.h
Go to the documentation of this file.
1#ifndef GAME_SERVER_TEEHISTORIAN_H
2#define GAME_SERVER_TEEHISTORIAN_H
3
4#include <base/hash.h>
5#include <engine/console.h>
8
9#include <ctime>
10
11class CConfig;
12class CTuningParams;
13class CUuidManager;
14
16{
17public:
18 typedef void (*WRITE_CALLBACK)(const void *pData, int DataSize, void *pUser);
19
20 struct CGameInfo
21 {
23 const char *m_pServerVersion;
25 const char *m_pPrngDescription;
26
27 const char *m_pServerName;
29 const char *m_pGameType;
30
31 const char *m_pMapName;
35
38
42 };
43
44 enum
45 {
48 };
49
51
52 void Reset(const CGameInfo *pGameInfo, WRITE_CALLBACK pfnWriteCallback, void *pUser);
53 void Finish();
54
55 bool Starting() const { return m_State == STATE_START; }
56
57 void BeginTick(int Tick);
58
59 void BeginPlayers();
60 void RecordPlayer(int ClientId, const CNetObj_CharacterCore *pChar);
61 void RecordDeadPlayer(int ClientId);
62 void RecordPlayerTeam(int ClientId, int Team);
63 void RecordTeamPractice(int Team, bool Practice);
64 void EndPlayers();
65
66 void BeginInputs();
67 void RecordPlayerInput(int ClientId, uint32_t UniqueClientId, const CNetObj_PlayerInput *pInput);
68 void RecordPlayerMessage(int ClientId, const void *pMsg, int MsgSize);
69 void RecordPlayerJoin(int ClientId, int Protocol);
70 void RecordPlayerRejoin(int ClientId);
71 void RecordPlayerReady(int ClientId);
72 void RecordPlayerDrop(int ClientId, const char *pReason);
73 void RecordPlayerName(int ClientId, const char *pName);
74 void RecordConsoleCommand(int ClientId, int FlagMask, const char *pCmd, IConsole::IResult *pResult);
75 void RecordTestExtra();
76 void RecordPlayerSwap(int ClientId1, int ClientId2);
77 void RecordTeamSaveSuccess(int Team, CUuid SaveId, const char *pTeamSave);
78 void RecordTeamSaveFailure(int Team);
79 void RecordTeamLoadSuccess(int Team, CUuid SaveId, const char *pTeamSave);
80 void RecordTeamLoadFailure(int Team);
81 void EndInputs();
82
83 void EndTick();
84
85 void RecordDDNetVersionOld(int ClientId, int DDNetVersion);
86 void RecordDDNetVersion(int ClientId, CUuid ConnectionId, int DDNetVersion, const char *pDDNetVersionStr);
87
88 void RecordAuthInitial(int ClientId, int Level, const char *pAuthName);
89 void RecordAuthLogin(int ClientId, int Level, const char *pAuthName);
90 void RecordAuthLogout(int ClientId);
91
92 void RecordAntibot(const void *pData, int DataSize);
93
94 void RecordPlayerFinish(int ClientId, int TimeTicks);
95 void RecordTeamFinish(int TeamId, int TimeTicks);
96
97 int m_Debug; // Possible values: 0, 1, 2.
98
99private:
100 void WriteHeader(const CGameInfo *pGameInfo);
101 void WriteExtra(CUuid Uuid, const void *pData, int DataSize);
102 void EnsureTickWrittenPlayerData(int ClientId);
103 void EnsureTickWritten();
104 void WriteTick();
105 void Write(const void *pData, int DataSize);
106
107 enum
108 {
117 };
118
120 {
122 int m_X;
123 int m_Y;
124
127
128 // DDNet team
130 };
131
132 struct CTeam
133 {
135 };
136
139
141
149};
150
151#endif // GAME_SERVER_TEEHISTORIAN_H
Definition: config.h:23
Definition: gameclient.h:64
Definition: teehistorian.h:16
void RecordDDNetVersionOld(int ClientId, int DDNetVersion)
Definition: teehistorian.cpp:724
void RecordTeamSaveFailure(int Team)
Definition: teehistorian.cpp:659
void Reset(const CGameInfo *pGameInfo, WRITE_CALLBACK pfnWriteCallback, void *pUser)
Definition: teehistorian.cpp:42
void RecordDeadPlayer(int ClientId)
Definition: teehistorian.cpp:314
int m_PrevMaxClientId
Definition: teehistorian.h:145
void RecordPlayerRejoin(int ClientId)
Definition: teehistorian.cpp:526
void RecordPlayerName(int ClientId, const char *pName)
Definition: teehistorian.cpp:576
void RecordPlayerReady(int ClientId)
Definition: teehistorian.cpp:542
void WriteTick()
Definition: teehistorian.cpp:393
CTeeHistorian()
Definition: teehistorian.cpp:35
void RecordPlayerFinish(int ClientId, int TimeTicks)
Definition: teehistorian.cpp:814
int m_Tick
Definition: teehistorian.h:144
void RecordTeamLoadFailure(int Team)
Definition: teehistorian.cpp:695
int m_MaxClientId
Definition: teehistorian.h:146
int m_LastWrittenTick
Definition: teehistorian.h:142
void RecordPlayer(int ClientId, const CNetObj_CharacterCore *pChar)
Definition: teehistorian.cpp:271
void RecordTeamPractice(int Team, bool Practice)
Definition: teehistorian.cpp:358
CTeehistorianPlayer m_aPrevPlayers[MAX_CLIENTS]
Definition: teehistorian.h:147
WRITE_CALLBACK m_pfnWriteCallback
Definition: teehistorian.h:137
int m_State
Definition: teehistorian.h:140
void BeginTick(int Tick)
Definition: teehistorian.cpp:227
bool m_TickWritten
Definition: teehistorian.h:143
void BeginPlayers()
Definition: teehistorian.cpp:242
int m_Debug
Definition: teehistorian.h:97
void EnsureTickWrittenPlayerData(int ClientId)
Definition: teehistorian.cpp:254
void RecordAuthLogout(int ClientId)
Definition: teehistorian.cpp:790
void RecordTestExtra()
Definition: teehistorian.cpp:617
void RecordPlayerSwap(int ClientId1, int ClientId2)
Definition: teehistorian.cpp:627
void RecordAntibot(const void *pData, int DataSize)
Definition: teehistorian.cpp:804
void RecordConsoleCommand(int ClientId, int FlagMask, const char *pCmd, IConsole::IResult *pResult)
Definition: teehistorian.cpp:593
void RecordTeamLoadSuccess(int Team, CUuid SaveId, const char *pTeamSave)
Definition: teehistorian.cpp:675
void RecordAuthInitial(int ClientId, int Level, const char *pAuthName)
Definition: teehistorian.cpp:758
@ STATE_INPUTS
Definition: teehistorian.h:114
@ STATE_PLAYERS
Definition: teehistorian.h:112
@ STATE_BEFORE_TICK
Definition: teehistorian.h:110
@ NUM_STATES
Definition: teehistorian.h:116
@ STATE_START
Definition: teehistorian.h:109
@ STATE_BEFORE_PLAYERS
Definition: teehistorian.h:111
@ STATE_BEFORE_INPUTS
Definition: teehistorian.h:113
@ STATE_BEFORE_ENDTICK
Definition: teehistorian.h:115
bool Starting() const
Definition: teehistorian.h:55
void WriteHeader(const CGameInfo *pGameInfo)
Definition: teehistorian.cpp:74
void BeginInputs()
Definition: teehistorian.cpp:418
void EndTick()
Definition: teehistorian.cpp:718
void RecordAuthLogin(int ClientId, int Level, const char *pAuthName)
Definition: teehistorian.cpp:774
void RecordPlayerInput(int ClientId, uint32_t UniqueClientId, const CNetObj_PlayerInput *pInput)
Definition: teehistorian.cpp:425
void RecordTeamSaveSuccess(int Team, CUuid SaveId, const char *pTeamSave)
Definition: teehistorian.cpp:639
void RecordPlayerMessage(int ClientId, const void *pMsg, int MsgSize)
Definition: teehistorian.cpp:472
void * m_pWriteCallbackUserdata
Definition: teehistorian.h:138
void RecordDDNetVersion(int ClientId, CUuid ConnectionId, int DDNetVersion, const char *pDDNetVersionStr)
Definition: teehistorian.cpp:739
CTeam m_aPrevTeams[MAX_CLIENTS]
Definition: teehistorian.h:148
void WriteExtra(CUuid Uuid, const void *pData, int DataSize)
Definition: teehistorian.cpp:214
@ PROTOCOL_6
Definition: teehistorian.h:46
@ PROTOCOL_7
Definition: teehistorian.h:47
void Write(const void *pData, int DataSize)
Definition: teehistorian.cpp:380
void RecordPlayerDrop(int ClientId, const char *pReason)
Definition: teehistorian.cpp:558
void RecordTeamFinish(int TeamId, int TimeTicks)
Definition: teehistorian.cpp:828
void RecordPlayerJoin(int ClientId, int Protocol)
Definition: teehistorian.cpp:496
void Finish()
Definition: teehistorian.cpp:842
void EnsureTickWritten()
Definition: teehistorian.cpp:385
void(* WRITE_CALLBACK)(const void *pData, int DataSize, void *pUser)
Definition: teehistorian.h:18
void EndPlayers()
Definition: teehistorian.cpp:411
void EndInputs()
Definition: teehistorian.cpp:711
void RecordPlayerTeam(int ClientId, int Team)
Definition: teehistorian.cpp:336
Definition: gamecore.h:41
Definition: uuid_manager.h:53
Definition: console.h:45
@ MAX_CLIENTS
Definition: protocol.h:88
Definition: protocol.h:435
Definition: protocol.h:360
Definition: teehistorian.h:21
const char * m_pPrngDescription
Definition: teehistorian.h:25
CUuid m_GameUuid
Definition: teehistorian.h:22
CConfig * m_pConfig
Definition: teehistorian.h:39
bool m_HavePrevGameUuid
Definition: teehistorian.h:36
const char * m_pServerName
Definition: teehistorian.h:27
const char * m_pServerVersion
Definition: teehistorian.h:23
int m_MapSize
Definition: teehistorian.h:32
CUuid m_PrevGameUuid
Definition: teehistorian.h:37
int m_ServerPort
Definition: teehistorian.h:28
const char * m_pMapName
Definition: teehistorian.h:31
CTuningParams * m_pTuning
Definition: teehistorian.h:40
SHA256_DIGEST m_MapSha256
Definition: teehistorian.h:33
time_t m_StartTime
Definition: teehistorian.h:24
int m_MapCrc
Definition: teehistorian.h:34
CUuidManager * m_pUuids
Definition: teehistorian.h:41
const char * m_pGameType
Definition: teehistorian.h:29
Definition: teehistorian.h:133
bool m_Practice
Definition: teehistorian.h:134
Definition: teehistorian.h:120
bool m_Alive
Definition: teehistorian.h:121
CNetObj_PlayerInput m_Input
Definition: teehistorian.h:125
uint32_t m_UniqueClientId
Definition: teehistorian.h:126
int m_Team
Definition: teehistorian.h:129
int m_X
Definition: teehistorian.h:122
int m_Y
Definition: teehistorian.h:123
Definition: uuid_manager.h:17
Definition: hash.h:15