TrinityCore
Loading...
Searching...
No Matches
Packet.cpp
Go to the documentation of this file.
1
/*
2
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3
*
4
* This program is free software; you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License as published by the
6
* Free Software Foundation; either version 2 of the License, or (at your
7
* option) any later version.
8
*
9
* This program is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12
* more details.
13
*
14
* You should have received a copy of the GNU General Public License along
15
* with this program. If not, see <http://www.gnu.org/licenses/>.
16
*/
17
18
#include "
Packet.h
"
19
#include "
Errors.h
"
20
21
WorldPackets::Packet::Packet
(
WorldPacket
&& worldPacket) : _worldPacket(
std
::move(worldPacket))
22
{
23
}
24
25
WorldPackets::ServerPacket::ServerPacket
(
OpcodeServer
opcode,
size_t
initialSize
/*= 200*/
,
ConnectionType
connection
/*= CONNECTION_TYPE_DEFAULT*/
)
26
:
Packet
(
WorldPacket
(opcode, initialSize, connection))
27
{
28
}
29
30
void
WorldPackets::ServerPacket::Read
()
31
{
32
ABORT_MSG
(
"Read not implemented for server packets."
);
33
}
34
35
WorldPackets::ClientPacket::ClientPacket
(
OpcodeClient
expectedOpcode,
WorldPacket
&& packet) :
Packet
(
std
::move(packet))
36
{
37
ASSERT
(
GetOpcode
() == expectedOpcode);
38
}
39
40
WorldPackets::ClientPacket::ClientPacket
(
WorldPacket
&& packet) :
Packet
(
std
::move(packet))
41
{
42
}
43
44
WorldPacket
const
*
WorldPackets::ClientPacket::Write
()
45
{
46
ABORT_MSG
(
"Write not allowed for client packets."
);
47
// Shut up some compilers
48
return
nullptr
;
49
}
Errors.h
ABORT_MSG
#define ABORT_MSG
Definition
Errors.h:88
ASSERT
#define ASSERT
Definition
Errors.h:80
ConnectionType
ConnectionType
Definition
Opcodes.h:27
OpcodeServer
OpcodeServer
Definition
Opcodes.h:1085
OpcodeClient
OpcodeClient
Definition
Opcodes.h:38
Packet.h
WorldPacket
Definition
WorldPacket.h:26
WorldPackets::ClientPacket::Write
WorldPacket const * Write() final
Definition
Packet.cpp:44
WorldPackets::ClientPacket::ClientPacket
ClientPacket(WorldPacket &&packet)
Definition
Packet.cpp:40
WorldPackets::ClientPacket::GetOpcode
OpcodeClient GetOpcode() const
Definition
Packet.h:68
WorldPackets::Packet
Definition
Packet.h:26
WorldPackets::Packet::Packet
Packet(WorldPacket &&worldPacket)
Definition
Packet.cpp:21
WorldPackets::ServerPacket::ServerPacket
ServerPacket(OpcodeServer opcode, size_t initialSize=200, ConnectionType connection=CONNECTION_TYPE_DEFAULT)
Definition
Packet.cpp:25
WorldPackets::ServerPacket::Read
void Read() final
Definition
Packet.cpp:30
std
STL namespace.
server
game
Server
Packet.cpp
Generated on Sun May 10 2026 02:09:01 for TrinityCore by
1.9.8