From 1f94c318c5df7a17a07f8d553f92a0325ff633fe Mon Sep 17 00:00:00 2001 From: Howaner Date: Sun, 25 Jan 2015 00:40:59 +0100 Subject: Readded old DistributeStackToAreas() comment. --- src/UI/Window.cpp | 7 +++++-- 1 file 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 & 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 -- cgit v1.2.3