summaryrefslogtreecommitdiff
path: root/src/gui/widgets/itemcontainer.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-11-02 18:10:42 +0300
committerAndrei Karas <akaras@inbox.ru>2015-11-02 18:10:42 +0300
commit2127361148d4ea5531a115cc92131a3f956ca528 (patch)
tree668182e046ff19bbacdc8cfc326bc2fab224b62b /src/gui/widgets/itemcontainer.cpp
parentf89de74b1ac1cd9a02a70dab9221d601296da8cd (diff)
downloadplus-2127361148d4ea5531a115cc92131a3f956ca528.tar.gz
plus-2127361148d4ea5531a115cc92131a3f956ca528.tar.bz2
plus-2127361148d4ea5531a115cc92131a3f956ca528.tar.xz
plus-2127361148d4ea5531a115cc92131a3f956ca528.zip
Allow add items to npc inventory from same slot multiple times.
Added items automatically removed from inventory item amounts.
Diffstat (limited to 'src/gui/widgets/itemcontainer.cpp')
-rw-r--r--src/gui/widgets/itemcontainer.cpp10
1 files changed, 7 insertions, 3 deletions
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;
}