#include "blitz/protocol/PacketHandler.h"
#include "blitz/protocol/Packets.h"

#define REGISTER_DISPATCH_CLASS(className)                                                                                            \
	void className::Dispatch(PacketHandler* handler) const { handler->HandlePacket(this); }

namespace blitz {
namespace protocol {

void Packet::WritePacketID(DataBuffer& data, bool packetID) const {
	if (packetID)
		data << GetID();
}

REGISTER_DISPATCH_CLASS(PlayerLoginPacket)
REGISTER_DISPATCH_CLASS(KeepAlivePacket)
REGISTER_DISPATCH_CLASS(PlayerListPacket)
REGISTER_DISPATCH_CLASS(PlayerJoinPacket)
REGISTER_DISPATCH_CLASS(PlayerLeavePacket)
REGISTER_DISPATCH_CLASS(ConnexionInfoPacket)
REGISTER_DISPATCH_CLASS(DisconnectPacket)
REGISTER_DISPATCH_CLASS(ServerTpsPacket)
REGISTER_DISPATCH_CLASS(ChatPacket)

}  // namespace protocol
}  // namespace blitz