cWindow: Fixed item dupe glitch with painting (#278)
This commit is contained in:
parent
8fa8107e45
commit
11c5ad1170
@ -628,7 +628,7 @@ int cWindow::DistributeItemToSlots(cPlayer & a_Player, const cItem & a_Item, int
|
|||||||
|
|
||||||
// Modify the item at the slot
|
// Modify the item at the slot
|
||||||
cItem AtSlot(*Area->GetSlot(LocalSlotNum, a_Player));
|
cItem AtSlot(*Area->GetSlot(LocalSlotNum, a_Player));
|
||||||
int MaxStack = ItemHandler(AtSlot.m_ItemType)->GetMaxStackSize();
|
int MaxStack = AtSlot.GetMaxStackSize();
|
||||||
if (AtSlot.IsEmpty())
|
if (AtSlot.IsEmpty())
|
||||||
{
|
{
|
||||||
// Empty, just move all of it there:
|
// 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);
|
Area->SetSlot(LocalSlotNum, a_Player, ToStore);
|
||||||
NumDistributed += ToStore.m_ItemCount;
|
NumDistributed += ToStore.m_ItemCount;
|
||||||
}
|
}
|
||||||
else
|
else if (AtSlot.IsStackableWith(a_Item))
|
||||||
{
|
{
|
||||||
// Occupied, add and cap at MaxStack:
|
// Occupied, add and cap at MaxStack:
|
||||||
int CanStore = std::min(a_NumToEachSlot, (int)MaxStack - AtSlot.m_ItemCount);
|
int CanStore = std::min(a_NumToEachSlot, (int)MaxStack - AtSlot.m_ItemCount);
|
||||||
|
Loading…
Reference in New Issue
Block a user