From 4aed49a70fe2e4fa3600b31525766c52bff52e3d Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Thu, 4 Apr 2013 11:47:31 +0000 Subject: Fixed personal crafting grid not being tossed on inventory close. FS #355, http://www.mc-server.org/support/index.php?do=details&task_id=355 git-svn-id: http://mc-server.googlecode.com/svn/trunk@1358 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Protocol/Protocol.h | 2 +- source/Protocol/Protocol125.cpp | 10 ++++++++-- source/Protocol/Protocol125.h | 2 +- source/Protocol/ProtocolRecognizer.cpp | 4 ++-- source/Protocol/ProtocolRecognizer.h | 2 +- 5 files changed, 13 insertions(+), 7 deletions(-) (limited to 'source/Protocol') diff --git a/source/Protocol/Protocol.h b/source/Protocol/Protocol.h index 97c80ce35..4cf041cdf 100644 --- a/source/Protocol/Protocol.h +++ b/source/Protocol/Protocol.h @@ -96,7 +96,7 @@ public: virtual void SendWeather (eWeather a_Weather) = 0; virtual void SendWholeInventory (const cInventory & a_Inventory) = 0; virtual void SendWholeInventory (const cWindow & a_Window) = 0; - virtual void SendWindowClose (char a_WindowID) = 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; /// Returns the ServerID used for authentication through session.minecraft.net diff --git a/source/Protocol/Protocol125.cpp b/source/Protocol/Protocol125.cpp index f09cf7178..8d212a4a2 100644 --- a/source/Protocol/Protocol125.cpp +++ b/source/Protocol/Protocol125.cpp @@ -863,11 +863,17 @@ void cProtocol125::SendWholeInventory(const cWindow & a_Window) -void cProtocol125::SendWindowClose(char a_WindowID) +void cProtocol125::SendWindowClose(const cWindow & a_Window) { + if (a_Window.GetWindowType() == cWindow::Inventory) + { + // Do not send inventory-window-close + return; + } + cCSLock Lock(m_CSPacket); WriteByte(PACKET_WINDOW_CLOSE); - WriteByte(a_WindowID); + WriteByte(a_Window.GetWindowID()); Flush(); } diff --git a/source/Protocol/Protocol125.h b/source/Protocol/Protocol125.h index 8b724e036..4191d0793 100644 --- a/source/Protocol/Protocol125.h +++ b/source/Protocol/Protocol125.h @@ -73,7 +73,7 @@ public: virtual void SendWeather (eWeather a_Weather) override; virtual void SendWholeInventory (const cInventory & a_Inventory) override; virtual void SendWholeInventory (const cWindow & a_Window) override; - virtual void SendWindowClose (char a_WindowID) 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 AString GetAuthServerID(void) override; diff --git a/source/Protocol/ProtocolRecognizer.cpp b/source/Protocol/ProtocolRecognizer.cpp index 787672286..ad99839e4 100644 --- a/source/Protocol/ProtocolRecognizer.cpp +++ b/source/Protocol/ProtocolRecognizer.cpp @@ -556,10 +556,10 @@ void cProtocolRecognizer::SendWholeInventory(const cWindow & a_Window) -void cProtocolRecognizer::SendWindowClose(char a_WindowID) +void cProtocolRecognizer::SendWindowClose(const cWindow & a_Window) { ASSERT(m_Protocol != NULL); - m_Protocol->SendWindowClose(a_WindowID); + m_Protocol->SendWindowClose(a_Window); } diff --git a/source/Protocol/ProtocolRecognizer.h b/source/Protocol/ProtocolRecognizer.h index 866a84eb0..8218dbcaa 100644 --- a/source/Protocol/ProtocolRecognizer.h +++ b/source/Protocol/ProtocolRecognizer.h @@ -100,7 +100,7 @@ public: virtual void SendWeather (eWeather a_Weather) override; virtual void SendWholeInventory (const cInventory & a_Inventory) override; virtual void SendWholeInventory (const cWindow & a_Window) override; - virtual void SendWindowClose (char a_WindowID) 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 AString GetAuthServerID(void) override; -- cgit v1.2.3