summaryrefslogtreecommitdiffstats
path: root/src/Protocol/ProtocolRecognizer.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-03-24 13:09:41 +0100
committerMattes D <github@xoft.cz>2015-03-24 13:09:41 +0100
commite5a7a730ed4f26eae896c56391bf3d2b5fecb852 (patch)
tree0209c1567f60af60999f3aeeb513a72f9eab2743 /src/Protocol/ProtocolRecognizer.cpp
parentMerge pull request #1775 from tommysanterre/terrainheightfix (diff)
parentAdded VarInt64, normalized cPacketizer datatype names. (diff)
downloadcuberite-e5a7a730ed4f26eae896c56391bf3d2b5fecb852.tar
cuberite-e5a7a730ed4f26eae896c56391bf3d2b5fecb852.tar.gz
cuberite-e5a7a730ed4f26eae896c56391bf3d2b5fecb852.tar.bz2
cuberite-e5a7a730ed4f26eae896c56391bf3d2b5fecb852.tar.lz
cuberite-e5a7a730ed4f26eae896c56391bf3d2b5fecb852.tar.xz
cuberite-e5a7a730ed4f26eae896c56391bf3d2b5fecb852.tar.zst
cuberite-e5a7a730ed4f26eae896c56391bf3d2b5fecb852.zip
Diffstat (limited to 'src/Protocol/ProtocolRecognizer.cpp')
-rw-r--r--src/Protocol/ProtocolRecognizer.cpp38
1 files changed, 25 insertions, 13 deletions
diff --git a/src/Protocol/ProtocolRecognizer.cpp b/src/Protocol/ProtocolRecognizer.cpp
index af9e0d1bc..36f8bc791 100644
--- a/src/Protocol/ProtocolRecognizer.cpp
+++ b/src/Protocol/ProtocolRecognizer.cpp
@@ -108,10 +108,10 @@ void cProtocolRecognizer::SendBlockAction(int a_BlockX, int a_BlockY, int a_Bloc
-void cProtocolRecognizer::SendBlockBreakAnim(int a_entityID, int a_BlockX, int a_BlockY, int a_BlockZ, char stage)
+void cProtocolRecognizer::SendBlockBreakAnim(UInt32 a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage)
{
ASSERT(m_Protocol != nullptr);
- m_Protocol->SendBlockBreakAnim(a_entityID, a_BlockX, a_BlockY, a_BlockZ, stage);
+ m_Protocol->SendBlockBreakAnim(a_EntityID, a_BlockX, a_BlockY, a_BlockZ, a_Stage);
}
@@ -911,13 +911,13 @@ bool cProtocolRecognizer::TryRecognizeLengthedProtocol(UInt32 a_PacketLengthRema
case PROTO_VERSION_1_7_2:
{
AString ServerAddress;
- short ServerPort;
+ UInt16 ServerPort;
UInt32 NextState;
if (!m_Buffer.ReadVarUTF8String(ServerAddress))
{
break;
}
- if (!m_Buffer.ReadBEShort(ServerPort))
+ if (!m_Buffer.ReadBEUInt16(ServerPort))
{
break;
}
@@ -926,19 +926,19 @@ bool cProtocolRecognizer::TryRecognizeLengthedProtocol(UInt32 a_PacketLengthRema
break;
}
m_Buffer.CommitRead();
- m_Protocol = new cProtocol172(m_Client, ServerAddress, (UInt16)ServerPort, NextState);
+ m_Protocol = new cProtocol172(m_Client, ServerAddress, ServerPort, NextState);
return true;
}
case PROTO_VERSION_1_7_6:
{
AString ServerAddress;
- short ServerPort;
+ UInt16 ServerPort;
UInt32 NextState;
if (!m_Buffer.ReadVarUTF8String(ServerAddress))
{
break;
}
- if (!m_Buffer.ReadBEShort(ServerPort))
+ if (!m_Buffer.ReadBEUInt16(ServerPort))
{
break;
}
@@ -947,19 +947,19 @@ bool cProtocolRecognizer::TryRecognizeLengthedProtocol(UInt32 a_PacketLengthRema
break;
}
m_Buffer.CommitRead();
- m_Protocol = new cProtocol176(m_Client, ServerAddress, (UInt16)ServerPort, NextState);
+ m_Protocol = new cProtocol176(m_Client, ServerAddress, ServerPort, NextState);
return true;
}
case PROTO_VERSION_1_8_0:
{
AString ServerAddress;
- short ServerPort;
+ UInt16 ServerPort;
UInt32 NextState;
if (!m_Buffer.ReadVarUTF8String(ServerAddress))
{
break;
}
- if (!m_Buffer.ReadBEShort(ServerPort))
+ if (!m_Buffer.ReadBEUInt16(ServerPort))
{
break;
}
@@ -968,12 +968,12 @@ bool cProtocolRecognizer::TryRecognizeLengthedProtocol(UInt32 a_PacketLengthRema
break;
}
m_Buffer.CommitRead();
- m_Protocol = new cProtocol180(m_Client, ServerAddress, (UInt16)ServerPort, NextState);
+ m_Protocol = new cProtocol180(m_Client, ServerAddress, ServerPort, NextState);
return true;
}
}
- LOGINFO("Client \"%s\" uses an unsupported protocol (lengthed, version %u)",
- m_Client->GetIPString().c_str(), ProtocolVersion
+ LOGINFO("Client \"%s\" uses an unsupported protocol (lengthed, version %u (0x%x))",
+ m_Client->GetIPString().c_str(), ProtocolVersion, ProtocolVersion
);
m_Client->Kick("Unsupported protocol version");
return false;
@@ -982,3 +982,15 @@ bool cProtocolRecognizer::TryRecognizeLengthedProtocol(UInt32 a_PacketLengthRema
+void cProtocolRecognizer::SendPacket(cPacketizer & a_Pkt)
+{
+ // This function should never be called - it needs to exists so that cProtocolRecognizer can be instantiated,
+ // but the actual sending is done by the internal m_Protocol itself.
+ LOGWARNING("%s: This function shouldn't ever be called.", __FUNCTION__);
+ ASSERT(!"Function not to be called");
+}
+
+
+
+
+