From 50c6a660922410e9c010583f597ee3f011f43226 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Fri, 21 Sep 2012 20:50:34 +0000 Subject: Working shift-click support in crafting areas; window update working in 1.3.2 git-svn-id: http://mc-server.googlecode.com/svn/trunk@869 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Protocol132.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'source/Protocol132.cpp') diff --git a/source/Protocol132.cpp b/source/Protocol132.cpp index 207266d99..32fd4b63c 100644 --- a/source/Protocol132.cpp +++ b/source/Protocol132.cpp @@ -13,6 +13,7 @@ #include "ChunkDataSerializer.h" #include "cPlayer.h" #include "cMonster.h" +#include "UI/cWindow.h" @@ -360,6 +361,26 @@ void cProtocol132::SendUnloadChunk(int a_ChunkX, int a_ChunkZ) +void cProtocol132::SendWholeInventory(const cWindow & a_Window) +{ + // 1.3.2 requires player inventory slots to be sent as SetSlot packets, + // otherwise it sometimes fails to update the window + super::SendWholeInventory(a_Window); + const cItem * Slots = m_Client->GetPlayer()->GetInventory().GetSlots(); + int BaseOffset = a_Window.GetNumSlots() - cInventory::c_NumSlots + cInventory::c_MainOffset; // the number of non-inventory slots the window has; inventory follows + char WindowID = a_Window.GetWindowID(); + for (int i = 0; i < cInventory::c_NumSlots - cInventory::c_MainOffset; i++) + { + SendInventorySlot(WindowID, BaseOffset + i, Slots[i + cInventory::c_MainOffset]); + } // for i - Slots[] + // Send even the item being dragged: + SendInventorySlot(-1, -1, m_Client->GetPlayer()->GetDraggingItem()); +} + + + + + AString cProtocol132::GetAuthServerID(void) { // http://wiki.vg/wiki/index.php?title=Session&oldid=2615 -- cgit v1.2.3