summaryrefslogtreecommitdiffstats
path: root/source/UI/cWindow.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-09-21 22:50:34 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-09-21 22:50:34 +0200
commit50c6a660922410e9c010583f597ee3f011f43226 (patch)
treec3a53b70f7ff1d390d7469b739b2f4afaafa9f8f /source/UI/cWindow.cpp
parentUI: Added shift-click support to most slot areas, except crafting. (diff)
downloadcuberite-50c6a660922410e9c010583f597ee3f011f43226.tar
cuberite-50c6a660922410e9c010583f597ee3f011f43226.tar.gz
cuberite-50c6a660922410e9c010583f597ee3f011f43226.tar.bz2
cuberite-50c6a660922410e9c010583f597ee3f011f43226.tar.lz
cuberite-50c6a660922410e9c010583f597ee3f011f43226.tar.xz
cuberite-50c6a660922410e9c010583f597ee3f011f43226.tar.zst
cuberite-50c6a660922410e9c010583f597ee3f011f43226.zip
Diffstat (limited to '')
-rw-r--r--source/UI/cWindow.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/source/UI/cWindow.cpp b/source/UI/cWindow.cpp
index 71d2a1200..7efbfaa5e 100644
--- a/source/UI/cWindow.cpp
+++ b/source/UI/cWindow.cpp
@@ -294,6 +294,35 @@ void cWindow::DistributeStack(cItem & a_ItemStack, cPlayer & a_Player, cSlotArea
+void cWindow::SendSlot(cPlayer & a_Player, cSlotArea * a_SlotArea, int a_RelativeSlotNum)
+{
+ int SlotBase = 0;
+ bool Found = false;
+ for (cSlotAreas::iterator itr = m_SlotAreas.begin(), end = m_SlotAreas.end(); itr != end; ++itr)
+ {
+ if (*itr == a_SlotArea)
+ {
+ Found = true;
+ break;
+ }
+ SlotBase += (*itr)->GetNumSlots();
+ } // for itr - m_SlotAreas[]
+ if (!Found)
+ {
+ LOGERROR("cWindow::SendSlot(): unknown a_SlotArea");
+ ASSERT(!"cWindow::SendSlot(): unknown a_SlotArea");
+ return;
+ }
+
+ a_Player.GetClientHandle()->SendInventorySlot(
+ m_WindowID, a_RelativeSlotNum + SlotBase, *(a_SlotArea->GetSlot(a_RelativeSlotNum, a_Player))
+ );
+}
+
+
+
+
+
void cWindow::Destroy(void)
{
LOGD("Destroying window %p (type %d)", this, m_WindowType);