summaryrefslogtreecommitdiffstats
path: root/source/UI/Window.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-11-10 21:42:56 +0100
committermadmaxoft <github@xoft.cz>2013-11-10 21:42:56 +0100
commitdde491ee0e3663440f05165f140e9086f68c69bf (patch)
tree4bec6ba6a6a60ff53fe3f2c7c9990fd4059cde5e /source/UI/Window.cpp
parentRenamed variables in cWolf. (diff)
parentImplemented inventory dblclick. (diff)
downloadcuberite-dde491ee0e3663440f05165f140e9086f68c69bf.tar
cuberite-dde491ee0e3663440f05165f140e9086f68c69bf.tar.gz
cuberite-dde491ee0e3663440f05165f140e9086f68c69bf.tar.bz2
cuberite-dde491ee0e3663440f05165f140e9086f68c69bf.tar.lz
cuberite-dde491ee0e3663440f05165f140e9086f68c69bf.tar.xz
cuberite-dde491ee0e3663440f05165f140e9086f68c69bf.tar.zst
cuberite-dde491ee0e3663440f05165f140e9086f68c69bf.zip
Diffstat (limited to 'source/UI/Window.cpp')
-rw-r--r--source/UI/Window.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/source/UI/Window.cpp b/source/UI/Window.cpp
index 1f023cb03..a09f5d682 100644
--- a/source/UI/Window.cpp
+++ b/source/UI/Window.cpp
@@ -386,6 +386,51 @@ void cWindow::DistributeStack(cItem & a_ItemStack, cPlayer & a_Player, cSlotArea
+bool cWindow::CollectItemsToHand(cItem & a_Dragging, cSlotArea & a_Area, cPlayer & a_Player, bool a_CollectFullStacks)
+{
+ // First ask the slot areas from a_Area till the end of list:
+ bool ShouldCollect = false;
+ for (cSlotAreas::iterator itr = m_SlotAreas.begin(), end = m_SlotAreas.end(); itr != end; ++itr)
+ {
+ if (&a_Area == *itr)
+ {
+ ShouldCollect = true;
+ }
+ if (!ShouldCollect)
+ {
+ continue;
+ }
+ if ((*itr)->CollectItemsToHand(a_Dragging, a_Player, a_CollectFullStacks))
+ {
+ // a_Dragging is full
+ return true;
+ }
+ }
+
+ // a_Dragging still not full, ask slot areas before a_Area in the list:
+ for (cSlotAreas::iterator itr = m_SlotAreas.begin(), end = m_SlotAreas.end(); itr != end; ++itr)
+ {
+ if (*itr == &a_Area)
+ {
+ // All areas processed
+ return false;
+ }
+ if ((*itr)->CollectItemsToHand(a_Dragging, a_Player, a_CollectFullStacks))
+ {
+ // a_Dragging is full
+ return true;
+ }
+ }
+ // Shouldn't reach here
+ // a_Area is expected to be part of m_SlotAreas[], so the "return false" in the loop above should have returned already
+ ASSERT(!"This branch should not be reached");
+ return false;
+}
+
+
+
+
+
void cWindow::SendSlot(cPlayer & a_Player, cSlotArea * a_SlotArea, int a_RelativeSlotNum)
{
int SlotBase = 0;