feat(Core/Packets): Port packet handling from TrinityCore (#5617)

* feat(Core/Packets): Port packet handling from TrinityCore

* 1

* 2

* 3

* 1

* 2

* #3670

* 3

* 1

* codestyle

* fix msvc warnings
This commit is contained in:
Kargatum
2021-05-22 05:10:46 +07:00
committed by GitHub
parent 537ebe87aa
commit 63a273507c
29 changed files with 2768 additions and 1868 deletions

View File

@@ -0,0 +1,37 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
* Copyright (C) 2021+ WarheadCore <https://github.com/WarheadCore>
*/
#include "Packet.h"
#include "Errors.h"
WorldPackets::Packet::Packet(WorldPacket&& worldPacket) : _worldPacket(std::move(worldPacket))
{
}
WorldPackets::ServerPacket::ServerPacket(OpcodeServer opcode, size_t initialSize /*= 200*/) : Packet(WorldPacket(opcode, initialSize))
{
}
void WorldPackets::ServerPacket::Read()
{
ASSERT(!"Read not implemented for server packets.");
}
WorldPackets::ClientPacket::ClientPacket(OpcodeClient expectedOpcode, WorldPacket&& packet) : Packet(std::move(packet))
{
ASSERT(GetOpcode() == expectedOpcode);
}
WorldPackets::ClientPacket::ClientPacket(WorldPacket&& packet)
: Packet(std::move(packet))
{
}
WorldPacket const* WorldPackets::ClientPacket::Write()
{
ASSERT(!"Write not allowed for client packets.");
// Shut up some compilers
return nullptr;
}