demboyz/demboyz/netmessages/nethandlers.h

40 lines
1.0 KiB
C
Raw Normal View History

#pragma once
#include <cstdint>
#include <sstream>
#include <array>
#include "netmessages.h"
class bf_read;
namespace NetHandlers
{
using BitRead = bf_read;
}
2016-04-28 04:31:33 +02:00
struct SourceGameContext;
#if !defined(MAX_OSPATH)
#define MAX_OSPATH 260 // max length of a filesystem pathname
#endif
#define DECLARE_NET_HANDLERS(msgname) \
namespace NetHandlers \
{ \
bool msgname##_BitRead_Internal(BitRead& bitbuf, SourceGameContext& context, NetMsg::msgname* data); \
inline bool msgname##_BitRead(BitRead& bitbuf, SourceGameContext& context, void* data) \
{ \
2015-05-16 00:05:28 +02:00
return msgname##_BitRead_Internal(bitbuf, context, reinterpret_cast<NetMsg::msgname*>(data)); \
} \
}
namespace NetHandlers
{
using NetDataStructArray = std::array<void*, NetMsg::SVC_LASTMSG + 1>;
void CreateNetMsgStructs(NetDataStructArray& netDataStructs);
void DestroyNetMsgStructs(NetDataStructArray& netDataStructs);
bool NetMsg_BitRead(uint32_t type, BitRead& bitbuf, SourceGameContext& context, void* data);
}