summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2015-01-25 00:40:59 +0100
committerHowaner <franzi.moos@googlemail.com>2015-01-25 00:40:59 +0100
commit1f94c318c5df7a17a07f8d553f92a0325ff633fe (patch)
tree7678add8322394a91047920f14580866343b6c3e /src
parentMerge branch 'master' into Inventory (diff)
downloadcuberite-1f94c318c5df7a17a07f8d553f92a0325ff633fe.tar
cuberite-1f94c318c5df7a17a07f8d553f92a0325ff633fe.tar.gz
cuberite-1f94c318c5df7a17a07f8d553f92a0325ff633fe.tar.bz2
cuberite-1f94c318c5df7a17a07f8d553f92a0325ff633fe.tar.lz
cuberite-1f94c318c5df7a17a07f8d553f92a0325ff633fe.tar.xz
cuberite-1f94c318c5df7a17a07f8d553f92a0325ff633fe.tar.zst
cuberite-1f94c318c5df7a17a07f8d553f92a0325ff633fe.zip
Diffstat (limited to '')
-rw-r--r--src/UI/Window.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/UI/Window.cpp b/src/UI/Window.cpp
index 8bb7607ff..bb2e2a807 100644
--- a/src/UI/Window.cpp
+++ b/src/UI/Window.cpp
@@ -393,11 +393,14 @@ bool cWindow::ForEachClient(cItemCallback<cClientHandle> & a_Callback)
void cWindow::DistributeStackToAreas(cItem & a_ItemStack, cPlayer & a_Player, cSlotAreas & a_AreasInOrder, bool a_ShouldApply, bool a_BackFill)
{
- for (size_t i = 0; i < 2; i++)
+ /* Ask each slot area to take as much of the stack as it can.
+ First ask only slots that already have the same kind of item
+ Then ask any remaining slots */
+ for (size_t Pass = 0; Pass < 2; Pass++)
{
for (auto SlotArea : a_AreasInOrder)
{
- SlotArea->DistributeStack(a_ItemStack, a_Player, a_ShouldApply, (i == 0), a_BackFill);
+ SlotArea->DistributeStack(a_ItemStack, a_Player, a_ShouldApply, (Pass == 0), a_BackFill);
if (a_ItemStack.IsEmpty())
{
// Distributed it all