mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 18:18:18 +00:00
5ae37e6c72
This system can easily be extended by independent authors without collisions, something the old system with plain increasing integers did not allow. Do this by utilizing the previously unused message code `NETMSG_NULL` which has a value of 0. This works for engine and game messages, snapshot items and events.
28 lines
558 B
C++
28 lines
558 B
C++
/* (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. */
|
|
#ifndef ENGINE_MESSAGE_H
|
|
#define ENGINE_MESSAGE_H
|
|
|
|
#include <engine/shared/packer.h>
|
|
#include <engine/shared/uuid_manager.h>
|
|
|
|
class CMsgPacker : public CPacker
|
|
{
|
|
public:
|
|
CMsgPacker(int Type)
|
|
{
|
|
Reset();
|
|
if(Type < OFFSET_UUID)
|
|
{
|
|
AddInt(Type);
|
|
}
|
|
else
|
|
{
|
|
AddInt(0); // NETMSG_EX, NETMSGTYPE_EX
|
|
g_UuidManager.PackUuid(Type, this);
|
|
}
|
|
}
|
|
};
|
|
|
|
#endif
|