From 2127361148d4ea5531a115cc92131a3f956ca528 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 2 Nov 2015 18:10:42 +0300 Subject: Allow add items to npc inventory from same slot multiple times. Added items automatically removed from inventory item amounts. --- src/gui/widgets/itemcontainer.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/gui/widgets') diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index 650911f9d..975b865d9 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -789,9 +789,13 @@ void ItemContainer::mouseReleased(MouseEvent &event) inventory = PlayerInfo::getInventory(); if (inventory) { - mInventory->addVirtualItem( - inventory->getItem(dragDrop.getTag()), - getSlotByXY(event.getX(), event.getY())); + Item *const item = inventory->getItem(dragDrop.getTag()); + if (mInventory->addVirtualItem( + item, + getSlotByXY(event.getX(), event.getY()))) + { + inventory->virtualRemove(item, 1); + } } return; } -- cgit v1.2.3-70-g09d2