summaryrefslogtreecommitdiffstats
path: root/src/Protocol/Protocol_1_12.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2020-09-12 22:08:23 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2020-09-18 17:41:06 +0200
commit7f372b12cb01f7df9d5466de11b36494353613a8 (patch)
treecdc570e1e5318beba83cc3b165efa0704b2c0edb /src/Protocol/Protocol_1_12.cpp
parentRemove unused ServerPort member (diff)
downloadcuberite-7f372b12cb01f7df9d5466de11b36494353613a8.tar
cuberite-7f372b12cb01f7df9d5466de11b36494353613a8.tar.gz
cuberite-7f372b12cb01f7df9d5466de11b36494353613a8.tar.bz2
cuberite-7f372b12cb01f7df9d5466de11b36494353613a8.tar.lz
cuberite-7f372b12cb01f7df9d5466de11b36494353613a8.tar.xz
cuberite-7f372b12cb01f7df9d5466de11b36494353613a8.tar.zst
cuberite-7f372b12cb01f7df9d5466de11b36494353613a8.zip
Diffstat (limited to 'src/Protocol/Protocol_1_12.cpp')
-rw-r--r--src/Protocol/Protocol_1_12.cpp26
1 files changed, 10 insertions, 16 deletions
diff --git a/src/Protocol/Protocol_1_12.cpp b/src/Protocol/Protocol_1_12.cpp
index dcbb6e17c..8a3076980 100644
--- a/src/Protocol/Protocol_1_12.cpp
+++ b/src/Protocol/Protocol_1_12.cpp
@@ -1022,9 +1022,8 @@ bool cProtocol_1_12::HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketTyp
{
switch (m_State)
{
- case 1:
+ case State::Status:
{
- // Status
switch (a_PacketType)
{
case 0x00: HandlePacketStatusRequest(a_ByteBuffer); return true;
@@ -1033,9 +1032,8 @@ bool cProtocol_1_12::HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketTyp
break;
}
- case 2:
+ case State::Login:
{
- // Login
switch (a_PacketType)
{
case 0x00: HandlePacketLoginStart(a_ByteBuffer); return true;
@@ -1044,9 +1042,8 @@ bool cProtocol_1_12::HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketTyp
break;
}
- case 3:
+ case State::Game:
{
- // Game
switch (a_PacketType)
{
case 0x00: HandleConfirmTeleport(a_ByteBuffer); return true;
@@ -1093,10 +1090,10 @@ bool cProtocol_1_12::HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketTyp
// Cannot kick the client - we don't know this state and thus the packet number for the kick packet
// Switch to a state when all further packets are silently ignored:
- m_State = 255;
+ m_State = State::Invalid;
return false;
}
- case 255:
+ case State::Invalid:
{
// This is the state used for "not processing packets anymore" when we receive a bad packet from a client.
// Do not output anything (the caller will do that for us), just return failure
@@ -1172,9 +1169,8 @@ bool cProtocol_1_12_1::HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketT
{
switch (m_State)
{
- case 1:
+ case State::Status:
{
- // Status
switch (a_PacketType)
{
case 0x00: HandlePacketStatusRequest(a_ByteBuffer); return true;
@@ -1183,9 +1179,8 @@ bool cProtocol_1_12_1::HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketT
break;
}
- case 2:
+ case State::Login:
{
- // Login
switch (a_PacketType)
{
case 0x00: HandlePacketLoginStart(a_ByteBuffer); return true;
@@ -1194,9 +1189,8 @@ bool cProtocol_1_12_1::HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketT
break;
}
- case 3:
+ case State::Game:
{
- // Game
switch (a_PacketType)
{
case 0x00: HandleConfirmTeleport(a_ByteBuffer); return true;
@@ -1243,10 +1237,10 @@ bool cProtocol_1_12_1::HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketT
// Cannot kick the client - we don't know this state and thus the packet number for the kick packet
// Switch to a state when all further packets are silently ignored:
- m_State = 255;
+ m_State = State::Invalid;
return false;
}
- case 255:
+ case State::Invalid:
{
// This is the state used for "not processing packets anymore" when we receive a bad packet from a client.
// Do not output anything (the caller will do that for us), just return failure