summaryrefslogtreecommitdiffstats
path: root/source/Protocol
diff options
context:
space:
mode:
Diffstat (limited to 'source/Protocol')
-rw-r--r--source/Protocol/Protocol.h2
-rw-r--r--source/Protocol/Protocol125.cpp12
-rw-r--r--source/Protocol/Protocol125.h2
-rw-r--r--source/Protocol/Protocol15x.cpp13
-rw-r--r--source/Protocol/Protocol15x.h2
-rw-r--r--source/Protocol/Protocol16x.cpp17
-rw-r--r--source/Protocol/Protocol16x.h2
-rw-r--r--source/Protocol/Protocol17x.cpp23
-rw-r--r--source/Protocol/Protocol17x.h6
-rw-r--r--source/Protocol/ProtocolRecognizer.cpp4
-rw-r--r--source/Protocol/ProtocolRecognizer.h6
11 files changed, 47 insertions, 42 deletions
diff --git a/source/Protocol/Protocol.h b/source/Protocol/Protocol.h
index 5d66808cf..5023ea227 100644
--- a/source/Protocol/Protocol.h
+++ b/source/Protocol/Protocol.h
@@ -101,7 +101,7 @@ public:
virtual void SendWeather (eWeather a_Weather) = 0;
virtual void SendWholeInventory (const cWindow & a_Window) = 0;
virtual void SendWindowClose (const cWindow & a_Window) = 0;
- virtual void SendWindowOpen (char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots) = 0;
+ virtual void SendWindowOpen (const cWindow & a_Window) = 0;
virtual void SendWindowProperty (const cWindow & a_Window, short a_Property, short a_Value) = 0;
/// Returns the ServerID used for authentication through session.minecraft.net
diff --git a/source/Protocol/Protocol125.cpp b/source/Protocol/Protocol125.cpp
index e53ab948c..9f2770815 100644
--- a/source/Protocol/Protocol125.cpp
+++ b/source/Protocol/Protocol125.cpp
@@ -956,19 +956,19 @@ void cProtocol125::SendWindowClose(const cWindow & a_Window)
-void cProtocol125::SendWindowOpen(char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots)
+void cProtocol125::SendWindowOpen(const cWindow & a_Window)
{
- if (a_WindowType < 0)
+ if (a_Window.GetWindowType() < 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 (a_Window.GetWindowID());
+ WriteByte (a_Window.GetWindowType());
+ WriteString(a_Window.GetWindowTitle());
+ WriteByte (a_Window.GetNumNonInventorySlots());
Flush();
}
diff --git a/source/Protocol/Protocol125.h b/source/Protocol/Protocol125.h
index ad61dea74..db913bb57 100644
--- a/source/Protocol/Protocol125.h
+++ b/source/Protocol/Protocol125.h
@@ -78,7 +78,7 @@ public:
virtual void SendWeather (eWeather a_Weather) override;
virtual void SendWholeInventory (const cWindow & a_Window) override;
virtual void SendWindowClose (const cWindow & a_Window) override;
- virtual void SendWindowOpen (char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots) override;
+ virtual void SendWindowOpen (const cWindow & a_Window) override;
virtual void SendWindowProperty (const cWindow & a_Window, short a_Property, short a_Value) override;
virtual AString GetAuthServerID(void) override;
diff --git a/source/Protocol/Protocol15x.cpp b/source/Protocol/Protocol15x.cpp
index cbae0700e..c337d26e7 100644
--- a/source/Protocol/Protocol15x.cpp
+++ b/source/Protocol/Protocol15x.cpp
@@ -12,6 +12,7 @@ Implements the 1.5.x protocol classes:
#include "Protocol15x.h"
#include "../ClientHandle.h"
#include "../Item.h"
+#include "../UI/Window.h"
@@ -54,19 +55,19 @@ cProtocol150::cProtocol150(cClientHandle * a_Client) :
-void cProtocol150::SendWindowOpen(char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots)
+void cProtocol150::SendWindowOpen(const cWindow & a_Window)
{
- if (a_WindowType < 0)
+ if (a_Window.GetWindowType() < 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 (a_Window.GetWindowID());
+ WriteByte (a_Window.GetWindowType());
+ WriteString(a_Window.GetWindowTitle());
+ WriteByte (a_Window.GetNumNonInventorySlots());
WriteByte (1); // Use title
Flush();
}
diff --git a/source/Protocol/Protocol15x.h b/source/Protocol/Protocol15x.h
index 3e1547df8..e554fe130 100644
--- a/source/Protocol/Protocol15x.h
+++ b/source/Protocol/Protocol15x.h
@@ -28,7 +28,7 @@ class cProtocol150 :
public:
cProtocol150(cClientHandle * a_Client);
- virtual void SendWindowOpen(char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots) override;
+ virtual void SendWindowOpen(const cWindow & a_Window) override;
virtual int ParseWindowClick(void);
} ;
diff --git a/source/Protocol/Protocol16x.cpp b/source/Protocol/Protocol16x.cpp
index 23e23d463..cfa27b3c4 100644
--- a/source/Protocol/Protocol16x.cpp
+++ b/source/Protocol/Protocol16x.cpp
@@ -17,6 +17,7 @@ Implements the 1.6.x protocol classes:
#include "../ClientHandle.h"
#include "../Entities/Entity.h"
#include "../Entities/Player.h"
+#include "../UI/Window.h"
@@ -153,23 +154,23 @@ void cProtocol161::SendRespawn(void)
-void cProtocol161::SendWindowOpen(char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots)
+void cProtocol161::SendWindowOpen(const cWindow & a_Window)
{
- if (a_WindowType < 0)
+ if (a_Window.GetWindowType() < 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 (a_Window.GetWindowID());
+ WriteByte (a_Window.GetWindowType());
+ WriteString(a_Window.GetWindowTitle());
+ WriteByte (a_Window.GetNumNonInventorySlots());
WriteByte (1); // Use title
- if (a_WindowType == 11) // horse / donkey
+ if (a_Window.GetWindowType() == cWindow::wtAnimalChest)
{
- WriteInt(0); // Unknown value sent only when window type is 11 (horse / donkey)
+ WriteInt(0); // TODO: The animal's EntityID
}
Flush();
}
diff --git a/source/Protocol/Protocol16x.h b/source/Protocol/Protocol16x.h
index 2447f90a7..325e41c5a 100644
--- a/source/Protocol/Protocol16x.h
+++ b/source/Protocol/Protocol16x.h
@@ -42,7 +42,7 @@ protected:
virtual void SendHealth (void) override;
virtual void SendPlayerMaxSpeed(void) override;
virtual void SendRespawn (void) override;
- virtual void SendWindowOpen (char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots) override;
+ virtual void SendWindowOpen (const cWindow & a_Window) override;
virtual int ParseEntityAction (void) override;
virtual int ParsePlayerAbilities(void) override;
diff --git a/source/Protocol/Protocol17x.cpp b/source/Protocol/Protocol17x.cpp
index a2b3a7a56..eee4f7d0e 100644
--- a/source/Protocol/Protocol17x.cpp
+++ b/source/Protocol/Protocol17x.cpp
@@ -841,21 +841,24 @@ void cProtocol172::SendWindowClose(const cWindow & a_Window)
-void cProtocol172::SendWindowOpen(char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots)
+void cProtocol172::SendWindowOpen(const cWindow & a_Window)
{
+ if (a_Window.GetWindowType() < 0)
+ {
+ // Do not send this packet for player inventory windows
+ return;
+ }
+
cPacketizer Pkt(*this, 0x2d);
- Pkt.WriteChar(a_WindowID);
- Pkt.WriteChar(a_WindowType);
- Pkt.WriteString(a_WindowTitle);
- Pkt.WriteChar(a_NumSlots);
+ Pkt.WriteChar(a_Window.GetWindowID());
+ Pkt.WriteChar(a_Window.GetWindowType());
+ Pkt.WriteString(a_Window.GetWindowTitle());
+ Pkt.WriteChar(a_Window.GetNumNonInventorySlots());
Pkt.WriteBool(true);
- /*
- // TODO:
- if (a_WindowType == cWindow::wtHorse)
+ if (a_Window.GetWindowType() == cWindow::wtAnimalChest)
{
- Pkt.WriteInt(HorseID);
+ Pkt.WriteInt(0); // TODO: The animal's EntityID
}
- */
}
diff --git a/source/Protocol/Protocol17x.h b/source/Protocol/Protocol17x.h
index ea7f7461f..844069403 100644
--- a/source/Protocol/Protocol17x.h
+++ b/source/Protocol/Protocol17x.h
@@ -85,9 +85,9 @@ public:
virtual void SendUpdateSign (int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) override;
virtual void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ ) override;
virtual void SendWeather (eWeather a_Weather) override;
- virtual void SendWholeInventory (const cWindow & a_Window) override;
- virtual void SendWindowClose (const cWindow & a_Window) override;
- virtual void SendWindowOpen (char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots) override;
+ virtual void SendWholeInventory (const cWindow & a_Window) override;
+ virtual void SendWindowClose (const cWindow & a_Window) override;
+ virtual void SendWindowOpen (const cWindow & a_Window) override;
virtual void SendWindowProperty (const cWindow & a_Window, short a_Property, short a_Value) override;
virtual AString GetAuthServerID(void) override { return m_AuthServerID; }
diff --git a/source/Protocol/ProtocolRecognizer.cpp b/source/Protocol/ProtocolRecognizer.cpp
index 501e8bbe0..6d0d71524 100644
--- a/source/Protocol/ProtocolRecognizer.cpp
+++ b/source/Protocol/ProtocolRecognizer.cpp
@@ -625,10 +625,10 @@ void cProtocolRecognizer::SendWindowClose(const cWindow & a_Window)
-void cProtocolRecognizer::SendWindowOpen(char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots)
+void cProtocolRecognizer::SendWindowOpen(const cWindow & a_Window)
{
ASSERT(m_Protocol != NULL);
- m_Protocol->SendWindowOpen(a_WindowID, a_WindowType, a_WindowTitle, a_NumSlots);
+ m_Protocol->SendWindowOpen(a_Window);
}
diff --git a/source/Protocol/ProtocolRecognizer.h b/source/Protocol/ProtocolRecognizer.h
index 9bf550309..2f217833a 100644
--- a/source/Protocol/ProtocolRecognizer.h
+++ b/source/Protocol/ProtocolRecognizer.h
@@ -111,9 +111,9 @@ public:
virtual void SendUpdateSign (int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) override;
virtual void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ ) override;
virtual void SendWeather (eWeather a_Weather) override;
- virtual void SendWholeInventory (const cWindow & a_Window) override;
- virtual void SendWindowClose (const cWindow & a_Window) override;
- virtual void SendWindowOpen (char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots) override;
+ virtual void SendWholeInventory (const cWindow & a_Window) override;
+ virtual void SendWindowClose (const cWindow & a_Window) override;
+ virtual void SendWindowOpen (const cWindow & a_Window) override;
virtual void SendWindowProperty (const cWindow & a_Window, short a_Property, short a_Value) override;
virtual AString GetAuthServerID(void) override;