summaryrefslogtreecommitdiffstats
path: root/src/Protocol/ProtocolRecognizer.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2020-01-03 14:30:51 +0100
committerMattes D <github@xoft.cz>2020-01-07 06:53:17 +0100
commit583fd0a3870cdc2089f201b03631c8213da9f53b (patch)
tree8602df200baa25a6c6e64bc53aaccd3c78ce497c /src/Protocol/ProtocolRecognizer.cpp
parentRoot: Load the UpgradeBlockTypePalette on startup. (diff)
downloadcuberite-583fd0a3870cdc2089f201b03631c8213da9f53b.tar
cuberite-583fd0a3870cdc2089f201b03631c8213da9f53b.tar.gz
cuberite-583fd0a3870cdc2089f201b03631c8213da9f53b.tar.bz2
cuberite-583fd0a3870cdc2089f201b03631c8213da9f53b.tar.lz
cuberite-583fd0a3870cdc2089f201b03631c8213da9f53b.tar.xz
cuberite-583fd0a3870cdc2089f201b03631c8213da9f53b.tar.zst
cuberite-583fd0a3870cdc2089f201b03631c8213da9f53b.zip
Diffstat (limited to 'src/Protocol/ProtocolRecognizer.cpp')
-rw-r--r--src/Protocol/ProtocolRecognizer.cpp36
1 files changed, 13 insertions, 23 deletions
diff --git a/src/Protocol/ProtocolRecognizer.cpp b/src/Protocol/ProtocolRecognizer.cpp
index d0f4c6f53..6ad0a095d 100644
--- a/src/Protocol/ProtocolRecognizer.cpp
+++ b/src/Protocol/ProtocolRecognizer.cpp
@@ -27,7 +27,6 @@
cProtocolRecognizer::cProtocolRecognizer(cClientHandle * a_Client) :
super(a_Client),
- m_Protocol(nullptr),
m_Buffer(8192), // We need a larger buffer to support BungeeCord - it sends one huge packet at the start
m_InPingForUnrecognizedVersion(false)
{
@@ -37,16 +36,6 @@ cProtocolRecognizer::cProtocolRecognizer(cClientHandle * a_Client) :
-cProtocolRecognizer::~cProtocolRecognizer()
-{
- delete m_Protocol;
- m_Protocol = nullptr;
-}
-
-
-
-
-
AString cProtocolRecognizer::GetVersionTextFromInt(int a_ProtocolVersion)
{
switch (a_ProtocolVersion)
@@ -61,6 +50,7 @@ AString cProtocolRecognizer::GetVersionTextFromInt(int a_ProtocolVersion)
case PROTO_VERSION_1_11_1: return "1.11.1";
case PROTO_VERSION_1_12: return "1.12";
case PROTO_VERSION_1_12_1: return "1.12.1";
+ case PROTO_VERSION_1_13: return "1.13";
}
ASSERT(!"Unknown protocol version");
return Printf("Unknown protocol (%d)", a_ProtocolVersion);
@@ -1098,62 +1088,62 @@ bool cProtocolRecognizer::TryRecognizeLengthedProtocol(UInt32 a_PacketLengthRema
case PROTO_VERSION_1_8_0:
{
m_Buffer.CommitRead();
- m_Protocol = new cProtocol_1_8_0(m_Client, ServerAddress, ServerPort, NextState);
+ m_Protocol.reset(new cProtocol_1_8_0(m_Client, ServerAddress, ServerPort, NextState));
return true;
}
case PROTO_VERSION_1_9_0:
{
- m_Protocol = new cProtocol_1_9_0(m_Client, ServerAddress, ServerPort, NextState);
+ m_Protocol.reset(new cProtocol_1_9_0(m_Client, ServerAddress, ServerPort, NextState));
return true;
}
case PROTO_VERSION_1_9_1:
{
- m_Protocol = new cProtocol_1_9_1(m_Client, ServerAddress, ServerPort, NextState);
+ m_Protocol.reset(new cProtocol_1_9_1(m_Client, ServerAddress, ServerPort, NextState));
return true;
}
case PROTO_VERSION_1_9_2:
{
- m_Protocol = new cProtocol_1_9_2(m_Client, ServerAddress, ServerPort, NextState);
+ m_Protocol.reset(new cProtocol_1_9_2(m_Client, ServerAddress, ServerPort, NextState));
return true;
}
case PROTO_VERSION_1_9_4:
{
- m_Protocol = new cProtocol_1_9_4(m_Client, ServerAddress, ServerPort, NextState);
+ m_Protocol.reset(new cProtocol_1_9_4(m_Client, ServerAddress, ServerPort, NextState));
return true;
}
case PROTO_VERSION_1_10_0:
{
- m_Protocol = new cProtocol_1_10_0(m_Client, ServerAddress, ServerPort, NextState);
+ m_Protocol.reset(new cProtocol_1_10_0(m_Client, ServerAddress, ServerPort, NextState));
return true;
}
case PROTO_VERSION_1_11_0:
{
- m_Protocol = new cProtocol_1_11_0(m_Client, ServerAddress, ServerPort, NextState);
+ m_Protocol.reset(new cProtocol_1_11_0(m_Client, ServerAddress, ServerPort, NextState));
return true;
}
case PROTO_VERSION_1_11_1:
{
- m_Protocol = new cProtocol_1_11_1(m_Client, ServerAddress, ServerPort, NextState);
+ m_Protocol.reset(new cProtocol_1_11_1(m_Client, ServerAddress, ServerPort, NextState));
return true;
}
case PROTO_VERSION_1_12:
{
- m_Protocol = new cProtocol_1_12(m_Client, ServerAddress, ServerPort, NextState);
+ m_Protocol.reset(new cProtocol_1_12(m_Client, ServerAddress, ServerPort, NextState));
return true;
}
case PROTO_VERSION_1_12_1:
{
- m_Protocol = new cProtocol_1_12_1(m_Client, ServerAddress, ServerPort, NextState);
+ m_Protocol.reset(new cProtocol_1_12_1(m_Client, ServerAddress, ServerPort, NextState));
return true;
}
case PROTO_VERSION_1_12_2:
{
- m_Protocol = new cProtocol_1_12_2(m_Client, ServerAddress, ServerPort, NextState);
+ m_Protocol.reset(new cProtocol_1_12_2(m_Client, ServerAddress, ServerPort, NextState));
return true;
}
case PROTO_VERSION_1_13:
{
- m_Protocol = new cProtocol_1_13(m_Client, ServerAddress, ServerPort, NextState);
+ m_Protocol.reset(new cProtocol_1_13(m_Client, ServerAddress, ServerPort, NextState));
return true;
}
default: