From 11c5ad1170087dac4c79382f0dd4a18424b5c766 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Tue, 12 Nov 2013 13:15:09 +0100 Subject: cWindow: Fixed item dupe glitch with painting (#278) --- source/UI/Window.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/UI/Window.cpp') diff --git a/source/UI/Window.cpp b/source/UI/Window.cpp index a09f5d682..f5c62692f 100644 --- a/source/UI/Window.cpp +++ b/source/UI/Window.cpp @@ -628,7 +628,7 @@ int cWindow::DistributeItemToSlots(cPlayer & a_Player, const cItem & a_Item, int // Modify the item at the slot cItem AtSlot(*Area->GetSlot(LocalSlotNum, a_Player)); - int MaxStack = ItemHandler(AtSlot.m_ItemType)->GetMaxStackSize(); + int MaxStack = AtSlot.GetMaxStackSize(); if (AtSlot.IsEmpty()) { // Empty, just move all of it there: @@ -637,7 +637,7 @@ int cWindow::DistributeItemToSlots(cPlayer & a_Player, const cItem & a_Item, int Area->SetSlot(LocalSlotNum, a_Player, ToStore); NumDistributed += ToStore.m_ItemCount; } - else + else if (AtSlot.IsStackableWith(a_Item)) { // Occupied, add and cap at MaxStack: int CanStore = std::min(a_NumToEachSlot, (int)MaxStack - AtSlot.m_ItemCount); -- cgit v1.2.3