From 6d5a5eb665d8f13dd3e4e7c279967556b0f9fa91 Mon Sep 17 00:00:00 2001 From: Howaner Date: Thu, 11 Sep 2014 22:27:35 +0200 Subject: Removed GetProtocolVersion() from the protocols. --- src/Protocol/Protocol.h | 8 ++------ src/Protocol/Protocol125.cpp | 3 +-- src/Protocol/Protocol132.cpp | 2 -- src/Protocol/Protocol14x.cpp | 3 --- src/Protocol/Protocol17x.cpp | 4 +--- src/Protocol/Protocol18x.cpp | 3 +-- src/Protocol/ProtocolRecognizer.cpp | 2 +- 7 files changed, 6 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/Protocol/Protocol.h b/src/Protocol/Protocol.h index 2b41b809c..8c9fadd1a 100644 --- a/src/Protocol/Protocol.h +++ b/src/Protocol/Protocol.h @@ -46,11 +46,11 @@ typedef unsigned char Byte; class cProtocol { public: - cProtocol(cClientHandle * a_Client, int a_ProtocolVersion) : - m_ProtocolVersion(a_ProtocolVersion), + cProtocol(cClientHandle * a_Client) : m_Client(a_Client) { } + virtual ~cProtocol() {} /// Called when client sends some data @@ -131,11 +131,7 @@ public: /// Returns the ServerID used for authentication through session.minecraft.net virtual AString GetAuthServerID(void) = 0; - /** Returns the protocol version of this protocol. */ - int GetProtocolVersion(void) const { return m_ProtocolVersion; } - protected: - int m_ProtocolVersion; cClientHandle * m_Client; cCriticalSection m_CSPacket; // Each SendXYZ() function must acquire this CS in order to send the whole packet at once diff --git a/src/Protocol/Protocol125.cpp b/src/Protocol/Protocol125.cpp index 1d6049097..0c481024e 100644 --- a/src/Protocol/Protocol125.cpp +++ b/src/Protocol/Protocol125.cpp @@ -16,7 +16,6 @@ Documentation: #include "../ClientHandle.h" #include "../World.h" #include "ChunkDataSerializer.h" -#include "ProtocolRecognizer.h" #include "../Entities/Entity.h" #include "../Entities/ExpOrb.h" #include "../Mobs/Monster.h" @@ -133,7 +132,7 @@ typedef unsigned char Byte; cProtocol125::cProtocol125(cClientHandle * a_Client) : - super(a_Client, cProtocolRecognizer::PROTO_VERSION_1_2_5), + super(a_Client), m_ReceivedData(32 KiB), m_LastSentDimension(dimNotSet) { diff --git a/src/Protocol/Protocol132.cpp b/src/Protocol/Protocol132.cpp index 6fbc3a264..5fd2655b8 100644 --- a/src/Protocol/Protocol132.cpp +++ b/src/Protocol/Protocol132.cpp @@ -5,7 +5,6 @@ #include "Globals.h" #include "ChunkDataSerializer.h" -#include "ProtocolRecognizer.h" #include "Protocol132.h" #include "../Root.h" #include "../Server.h" @@ -79,7 +78,6 @@ cProtocol132::cProtocol132(cClientHandle * a_Client) : super(a_Client), m_IsEncrypted(false) { - m_ProtocolVersion = cProtocolRecognizer::PROTO_VERSION_1_3_2; } diff --git a/src/Protocol/Protocol14x.cpp b/src/Protocol/Protocol14x.cpp index 2d737acb4..d33314a2f 100644 --- a/src/Protocol/Protocol14x.cpp +++ b/src/Protocol/Protocol14x.cpp @@ -23,7 +23,6 @@ Implements the 1.4.x protocol classes representing these protocols: #include "../UI/Window.h" #include "../Entities/Pickup.h" #include "../Entities/FallingBlock.h" -#include "ProtocolRecognizer.h" #ifdef _MSC_VER #pragma warning(push) @@ -73,7 +72,6 @@ enum cProtocol142::cProtocol142(cClientHandle * a_Client) : super(a_Client) { - m_ProtocolVersion = cProtocolRecognizer::PROTO_VERSION_1_4_2; } @@ -152,7 +150,6 @@ void cProtocol142::SendTimeUpdate(Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_Do cProtocol146::cProtocol146(cClientHandle * a_Client) : super(a_Client) { - m_ProtocolVersion = cProtocolRecognizer::PROTO_VERSION_1_4_6; } diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp index 2b0c8baf8..b3c78a8ba 100644 --- a/src/Protocol/Protocol17x.cpp +++ b/src/Protocol/Protocol17x.cpp @@ -12,7 +12,6 @@ Implements the 1.7.x protocol classes: #include "Globals.h" #include "json/json.h" #include "Protocol17x.h" -#include "ProtocolRecognizer.h" #include "ChunkDataSerializer.h" #include "PolarSSL++/Sha1Checksum.h" @@ -93,7 +92,7 @@ extern bool g_ShouldLogCommIn, g_ShouldLogCommOut; // cProtocol172: cProtocol172::cProtocol172(cClientHandle * a_Client, const AString & a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State) : - super(a_Client, cProtocolRecognizer::PROTO_VERSION_1_7_2), + super(a_Client), m_ServerAddress(a_ServerAddress), m_ServerPort(a_ServerPort), m_State(a_State), @@ -3064,7 +3063,6 @@ void cProtocol172::cPacketizer::WriteEntityProperties(const cEntity & a_Entity) cProtocol176::cProtocol176(cClientHandle * a_Client, const AString &a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State) : super(a_Client, a_ServerAddress, a_ServerPort, a_State) { - m_ProtocolVersion = cProtocolRecognizer::PROTO_VERSION_1_7_6; } diff --git a/src/Protocol/Protocol18x.cpp b/src/Protocol/Protocol18x.cpp index 978ae7807..142cae6a5 100644 --- a/src/Protocol/Protocol18x.cpp +++ b/src/Protocol/Protocol18x.cpp @@ -11,7 +11,6 @@ Implements the 1.8.x protocol classes: #include "Globals.h" #include "json/json.h" #include "Protocol18x.h" -#include "ProtocolRecognizer.h" #include "ChunkDataSerializer.h" #include "PolarSSL++/Sha1Checksum.h" @@ -92,7 +91,7 @@ extern bool g_ShouldLogCommIn, g_ShouldLogCommOut; // cProtocol180: cProtocol180::cProtocol180(cClientHandle * a_Client, const AString & a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State) : - super(a_Client, cProtocolRecognizer::PROTO_VERSION_1_8_0), + super(a_Client), m_ServerAddress(a_ServerAddress), m_ServerPort(a_ServerPort), m_State(a_State), diff --git a/src/Protocol/ProtocolRecognizer.cpp b/src/Protocol/ProtocolRecognizer.cpp index cf63583db..28b2b9c4b 100644 --- a/src/Protocol/ProtocolRecognizer.cpp +++ b/src/Protocol/ProtocolRecognizer.cpp @@ -26,7 +26,7 @@ cProtocolRecognizer::cProtocolRecognizer(cClientHandle * a_Client) : - super(a_Client, 0), + super(a_Client), m_Protocol(NULL), m_Buffer(512) { -- cgit v1.2.3