summaryrefslogtreecommitdiffstats
path: root/src/Protocol/Packetizer.h
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2019-09-09 18:22:37 +0200
committerMattes D <github@xoft.cz>2019-09-10 09:45:28 +0200
commit2c804dd34a58ff9702bd1ab2cab30f6a61503638 (patch)
tree16b3052c65f65231898205d670c52660f79b661f /src/Protocol/Packetizer.h
parentChunkGenerator: Changed to use cChunkCoords. (diff)
downloadcuberite-2c804dd34a58ff9702bd1ab2cab30f6a61503638.tar
cuberite-2c804dd34a58ff9702bd1ab2cab30f6a61503638.tar.gz
cuberite-2c804dd34a58ff9702bd1ab2cab30f6a61503638.tar.bz2
cuberite-2c804dd34a58ff9702bd1ab2cab30f6a61503638.tar.lz
cuberite-2c804dd34a58ff9702bd1ab2cab30f6a61503638.tar.xz
cuberite-2c804dd34a58ff9702bd1ab2cab30f6a61503638.tar.zst
cuberite-2c804dd34a58ff9702bd1ab2cab30f6a61503638.zip
Diffstat (limited to 'src/Protocol/Packetizer.h')
-rw-r--r--src/Protocol/Packetizer.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/Protocol/Packetizer.h b/src/Protocol/Packetizer.h
index 6d2284976..e3a409cf0 100644
--- a/src/Protocol/Packetizer.h
+++ b/src/Protocol/Packetizer.h
@@ -30,13 +30,13 @@ class cPacketizer
public:
/** Starts serializing a new packet into the protocol's m_OutPacketBuffer.
Locks the protocol's m_CSPacket to avoid multithreading issues. */
- cPacketizer(cProtocol & a_Protocol, UInt32 a_PacketType) :
+ cPacketizer(cProtocol & a_Protocol, cProtocol::ePacketType a_PacketType) :
m_Protocol(a_Protocol),
m_Out(a_Protocol.m_OutPacketBuffer),
m_Lock(a_Protocol.m_CSPacket),
m_PacketType(a_PacketType) // Used for logging purposes
{
- m_Out.WriteVarInt32(a_PacketType);
+ m_Out.WriteVarInt32(m_Protocol.GetPacketID(a_PacketType));
}
/** Sends the packet via the contained protocol's SendPacket() function. */
@@ -140,7 +140,11 @@ public:
/** Writes the specified UUID as a 128-bit BigEndian integer. */
void WriteUUID(const cUUID & a_UUID);
- UInt32 GetPacketType(void) const { return m_PacketType; }
+ cProtocol::ePacketType GetPacketType() const { return m_PacketType; }
+
+ /** Returns the human-readable representation of the packet type.
+ Used for logging the packets. */
+ static AString PacketTypeToStr(cProtocol::ePacketType a_PacketType);
protected:
/** The protocol instance in which the packet is being constructed. */
@@ -154,7 +158,7 @@ protected:
/** Type of the contained packet.
Used for logging purposes, the packet type is encoded into m_Out immediately in constructor. */
- UInt32 m_PacketType;
+ cProtocol::ePacketType m_PacketType;
} ;