diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-11-03 15:54:23 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-11-03 15:54:23 +0300 |
commit | cd636f7e367cfb7fa2c348d00071301a480d62c3 (patch) | |
tree | 2ed2f2565362aec0b02a1de0f4bdc5d6f6c3bc6e /src/gui/widgets | |
parent | b86f75e0faf7d646d5414cb6a6893bbb07131315 (diff) | |
download | manaplus-cd636f7e367cfb7fa2c348d00071301a480d62c3.tar.gz manaplus-cd636f7e367cfb7fa2c348d00071301a480d62c3.tar.bz2 manaplus-cd636f7e367cfb7fa2c348d00071301a480d62c3.tar.xz manaplus-cd636f7e367cfb7fa2c348d00071301a480d62c3.zip |
Fix removing items from npc inventory (restore amount in player inventory)
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/itemcontainer.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index 975b865d9..c9f5298b7 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -801,6 +801,7 @@ void ItemContainer::mouseReleased(MouseEvent &event) } else if (src == DRAGDROP_SOURCE_NPC) { + inventory = PlayerInfo::getInventory(); if (dst == DRAGDROP_SOURCE_NPC) { const Item *const item = mInventory->getItem( @@ -808,6 +809,8 @@ void ItemContainer::mouseReleased(MouseEvent &event) const int index = getSlotByXY(event.getX(), event.getY()); if (index == Inventory::NO_SLOT_INDEX) { + if (inventory) + inventory->virtualRestore(item, 1); mInventory->removeItemAt(dragDrop.getTag()); return; } @@ -830,13 +833,15 @@ void ItemContainer::mouseReleased(MouseEvent &event) } else { - inventory = PlayerInfo::getInventory(); if (inventory) { const Item *const item = inventory->getItem( dragDrop.getTag()); if (item) + { + inventory->virtualRestore(item, 1); mInventory->removeItemAt(dragDrop.getTag()); + } } return; } |