summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-03-14 21:34:37 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-03-14 21:34:37 +0100
commit75cc675bf2fe0bf69c819b47a3235bbb6c14baaa (patch)
tree6eb2509ab8a349147162673d5650ff04be62a43c
parentAdded a Noop fluid simulator that doesn't do anything with the fluid (fluid doesn't spread at all, behaves like a normal block) (diff)
downloadcuberite-75cc675bf2fe0bf69c819b47a3235bbb6c14baaa.tar
cuberite-75cc675bf2fe0bf69c819b47a3235bbb6c14baaa.tar.gz
cuberite-75cc675bf2fe0bf69c819b47a3235bbb6c14baaa.tar.bz2
cuberite-75cc675bf2fe0bf69c819b47a3235bbb6c14baaa.tar.lz
cuberite-75cc675bf2fe0bf69c819b47a3235bbb6c14baaa.tar.xz
cuberite-75cc675bf2fe0bf69c819b47a3235bbb6c14baaa.tar.zst
cuberite-75cc675bf2fe0bf69c819b47a3235bbb6c14baaa.zip
Diffstat (limited to '')
-rw-r--r--VC2008/MCServer.vcproj8
-rw-r--r--source/Protocol/Protocol14x.cpp6
-rw-r--r--source/Protocol/Protocol15x.cpp59
-rw-r--r--source/Protocol/Protocol15x.h36
-rw-r--r--source/Protocol/ProtocolRecognizer.cpp8
-rw-r--r--source/Protocol/ProtocolRecognizer.h8
6 files changed, 116 insertions, 9 deletions
diff --git a/VC2008/MCServer.vcproj b/VC2008/MCServer.vcproj
index cab4872c9..b8520b180 100644
--- a/VC2008/MCServer.vcproj
+++ b/VC2008/MCServer.vcproj
@@ -2175,6 +2175,14 @@
>
</File>
<File
+ RelativePath="..\source\Protocol\Protocol15x.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\source\Protocol\Protocol15x.h"
+ >
+ </File>
+ <File
RelativePath="..\source\Protocol\ProtocolRecognizer.cpp"
>
</File>
diff --git a/source/Protocol/Protocol14x.cpp b/source/Protocol/Protocol14x.cpp
index d19768c5c..c5597e041 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 000000000..61358fcdb
--- /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 000000000..f09ba09d7
--- /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 8a40376a3..935d89b9e 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 a4cec69f8..682e6fcf3 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);