diff --git a/VC2008/MCServer.vcproj b/VC2008/MCServer.vcproj index cab4872c..b8520b18 100644 --- a/VC2008/MCServer.vcproj +++ b/VC2008/MCServer.vcproj @@ -2174,6 +2174,14 @@ RelativePath="..\source\Protocol\Protocol14x.h" > + + + + diff --git a/source/Protocol/Protocol14x.cpp b/source/Protocol/Protocol14x.cpp index d19768c5..c5597e04 100644 --- a/source/Protocol/Protocol14x.cpp +++ b/source/Protocol/Protocol14x.cpp @@ -44,12 +44,6 @@ Implements the 1.4.x protocol classes representing these protocols: -typedef unsigned char Byte; - - - - - enum { PACKET_UPDATE_TIME = 0x04, diff --git a/source/Protocol/Protocol15x.cpp b/source/Protocol/Protocol15x.cpp new file mode 100644 index 00000000..61358fcd --- /dev/null +++ b/source/Protocol/Protocol15x.cpp @@ -0,0 +1,59 @@ + +// Protocol15x.cpp + +/* +Implements the 1.5.x protocol classes: + - cProtocol150 + - release 1.5 protocol (#60) +(others may be added later in the future for the 1.5 release series) +*/ + +#include "Globals.h" +#include "Protocol15x.h" + + + + + +enum +{ + PACKET_WINDOW_OPEN = 0x64, +} ; + + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cProtocol150: + +cProtocol150::cProtocol150(cClientHandle * a_Client) : + super(a_Client) +{ +} + + + + + +void cProtocol150::SendWindowOpen(char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots) +{ + if (a_WindowType < 0) + { + // Do not send for inventory windows + return; + } + cCSLock Lock(m_CSPacket); + WriteByte (PACKET_WINDOW_OPEN); + WriteByte (a_WindowID); + WriteByte (a_WindowType); + WriteString(a_WindowTitle); + WriteByte (a_NumSlots); + WriteByte (1); // Use title + Flush(); +} + + + + diff --git a/source/Protocol/Protocol15x.h b/source/Protocol/Protocol15x.h new file mode 100644 index 00000000..f09ba09d --- /dev/null +++ b/source/Protocol/Protocol15x.h @@ -0,0 +1,36 @@ + +// Protocol15x.h + +/* +Declares the 1.5.x protocol classes: + - cProtocol150 + - release 1.5 protocol (#60) +(others may be added later in the future for the 1.5 release series) +*/ + + + + + +#pragma once + +#include "Protocol14x.h" + + + + + +class cProtocol150 : + public cProtocol146 +{ + typedef cProtocol146 super; + +public: + cProtocol150(cClientHandle * a_Client); + + virtual void SendWindowOpen(char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots) override; +} ; + + + + diff --git a/source/Protocol/ProtocolRecognizer.cpp b/source/Protocol/ProtocolRecognizer.cpp index 8a40376a..935d89b9 100644 --- a/source/Protocol/ProtocolRecognizer.cpp +++ b/source/Protocol/ProtocolRecognizer.cpp @@ -10,6 +10,7 @@ #include "Protocol125.h" #include "Protocol132.h" #include "Protocol14x.h" +#include "Protocol15x.h" #include "../ClientHandle.h" #include "../Root.h" #include "../World.h" @@ -48,6 +49,7 @@ AString cProtocolRecognizer::GetVersionTextFromInt(int a_ProtocolVersion) case PROTO_VERSION_1_4_2: return "1.4.2"; case PROTO_VERSION_1_4_4: return "1.4.4"; case PROTO_VERSION_1_4_6: return "1.4.6"; + case PROTO_VERSION_1_5_0: return "1.5"; } ASSERT(!"Unknown protocol version"); return Printf("Unknown protocol (%d)", a_ProtocolVersion); @@ -629,6 +631,11 @@ bool cProtocolRecognizer::TryRecognizeProtocol(void) m_Protocol = new cProtocol146(m_Client); return true; } + case PROTO_VERSION_1_5_0: + { + m_Protocol = new cProtocol150(m_Client); + return true; + } } m_Protocol = new cProtocol125(m_Client); return true; @@ -660,6 +667,7 @@ void cProtocolRecognizer::HandleServerPing(void) case PROTO_VERSION_1_4_2: case PROTO_VERSION_1_4_4: case PROTO_VERSION_1_4_6: + case PROTO_VERSION_1_5_0: { // The server list ping now has 1 more byte of "magic". Mojang just loves to complicate stuff. // http://wiki.vg/wiki/index.php?title=Protocol&oldid=3101#Server_List_Ping_.280xFE.29 diff --git a/source/Protocol/ProtocolRecognizer.h b/source/Protocol/ProtocolRecognizer.h index a4cec69f..682e6fcf 100644 --- a/source/Protocol/ProtocolRecognizer.h +++ b/source/Protocol/ProtocolRecognizer.h @@ -18,8 +18,8 @@ // Adjust these if a new protocol is added or an old one is removed: -#define MCS_CLIENT_VERSIONS "1.2.4, 1.2.5, 1.3.1, 1.3.2, 1.4.2, 1.4.4, 1.4.5, 1.4.6, 1.4.7" -#define MCS_PROTOCOL_VERSIONS "29, 39, 47, 49, 51" +#define MCS_CLIENT_VERSIONS "1.2.4, 1.2.5, 1.3.1, 1.3.2, 1.4.2, 1.4.4, 1.4.5, 1.4.6, 1.4.7, 1.5" +#define MCS_PROTOCOL_VERSIONS "29, 39, 47, 49, 51, 60" @@ -38,8 +38,10 @@ public: PROTO_VERSION_1_4_2 = 47, PROTO_VERSION_1_4_4 = 49, PROTO_VERSION_1_4_6 = 51, + PROTO_VERSION_1_5_0 = 60, - PROTO_VERSION_LATEST = PROTO_VERSION_1_4_6, // Keep this up to date, this serves as the default for PrimaryServerVersion + PROTO_VERSION_NEXT, + PROTO_VERSION_LATEST = PROTO_VERSION_NEXT - 1, ///< Automatically assigned to the last protocol version, this serves as the default for PrimaryServerVersion } ; cProtocolRecognizer(cClientHandle * a_Client);