summaryrefslogtreecommitdiffstats
path: root/src/Protocol/Protocol_1_9.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_9.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 '')
-rw-r--r--src/Protocol/Protocol_1_9.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/Protocol/Protocol_1_9.cpp b/src/Protocol/Protocol_1_9.cpp
index b4fc47d0f..db0d4c17d 100644
--- a/src/Protocol/Protocol_1_9.cpp
+++ b/src/Protocol/Protocol_1_9.cpp
@@ -79,7 +79,7 @@ static const UInt32 OFF_HAND = 1;
////////////////////////////////////////////////////////////////////////////////
// cProtocol_1_9_0:
-cProtocol_1_9_0::cProtocol_1_9_0(cClientHandle * a_Client, const AString & a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State) :
+cProtocol_1_9_0::cProtocol_1_9_0(cClientHandle * a_Client, const AString & a_ServerAddress, UInt16 a_ServerPort, State a_State) :
Super(a_Client, a_ServerAddress, a_ServerPort, a_State),
m_IsTeleportIdConfirmed(true),
m_OutstandingTeleportId(0)
@@ -575,9 +575,8 @@ bool cProtocol_1_9_0::HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketTy
{
switch (m_State)
{
- case 1:
+ case State::Status:
{
- // Status
switch (a_PacketType)
{
case 0x00: HandlePacketStatusRequest(a_ByteBuffer); return true;
@@ -586,9 +585,8 @@ bool cProtocol_1_9_0::HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketTy
break;
}
- case 2:
+ case State::Login:
{
- // Login
switch (a_PacketType)
{
case 0x00: HandlePacketLoginStart (a_ByteBuffer); return true;
@@ -597,9 +595,8 @@ bool cProtocol_1_9_0::HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketTy
break;
}
- case 3:
+ case State::Game:
{
- // Game
switch (a_PacketType)
{
case 0x00: HandleConfirmTeleport (a_ByteBuffer); return true;
@@ -643,10 +640,10 @@ bool cProtocol_1_9_0::HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketTy
// 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