ddnet/src/engine/message.h
heinrich5991 5ae37e6c72 Add protocol extension with UUIDs
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.
2017-05-25 00:52:43 +02:00

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