DDraceNetwork Docs
eventhandler.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_EVENTHANDLER_H
4#define GAME_SERVER_EVENTHANDLER_H
5
6#include <cstdint>
7
9
11{
12 enum
13 {
15 MAX_DATASIZE = 128 * 64,
16 };
17
18 int m_aTypes[MAX_EVENTS]; // TODO: remove some of these arrays
23
25
28
29public:
31 void SetGameServer(CGameContext *pGameServer);
32
34 void *Create(int Type, int Size, CClientMask Mask = CClientMask().set());
35
36 template<typename T>
37 T *Create(CClientMask Mask = CClientMask().set())
38 {
39 return static_cast<T *>(Create(T::ms_MsgId, sizeof(T), Mask));
40 }
41
42 void Clear();
43 void Snap(int SnappingClient);
44
45 void EventToSixup(int *pType, int *pSize, const char **ppData);
46};
47
48#endif
Definition: eventhandler.h:11
int m_aSizes[MAX_EVENTS]
Definition: eventhandler.h:20
void SetGameServer(CGameContext *pGameServer)
Definition: eventhandler.cpp:20
T * Create(CClientMask Mask=CClientMask().set())
Definition: eventhandler.h:37
CEventHandler()
Definition: eventhandler.cpp:14
int m_NumEvents
Definition: eventhandler.h:27
int m_aOffsets[MAX_EVENTS]
Definition: eventhandler.h:19
int m_aTypes[MAX_EVENTS]
Definition: eventhandler.h:18
char m_aData[MAX_DATASIZE]
Definition: eventhandler.h:22
void EventToSixup(int *pType, int *pSize, const char **ppData)
Definition: eventhandler.cpp:71
void Clear()
Definition: eventhandler.cpp:42
int m_CurrentOffset
Definition: eventhandler.h:26
@ MAX_DATASIZE
Definition: eventhandler.h:15
@ MAX_EVENTS
Definition: eventhandler.h:14
CGameContext * GameServer() const
Definition: eventhandler.h:30
void Snap(int SnappingClient)
Definition: eventhandler.cpp:48
CClientMask m_aClientMasks[MAX_EVENTS]
Definition: eventhandler.h:21
class CGameContext * m_pGameServer
Definition: eventhandler.h:24
void * Create(int Type, int Size, CClientMask Mask=CClientMask().set())
Definition: eventhandler.cpp:25
Definition: gamecontext.h:79
std::bitset< MAX_CLIENTS > CClientMask
Definition: protocol.h:132