diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-01-08 23:07:23 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-01-08 23:07:23 +0300 |
commit | c74a91d49f6afea0b23acc4d5b4543dfee5e64db (patch) | |
tree | f851e96a451605b244e7fe77b7ad2c57b54a29b5 /src/gui/widgets/itemcontainer.cpp | |
parent | 52865ff4b24e3ea85967e76099b73f2e581a856d (diff) | |
download | manaverse-c74a91d49f6afea0b23acc4d5b4543dfee5e64db.tar.gz manaverse-c74a91d49f6afea0b23acc4d5b4543dfee5e64db.tar.bz2 manaverse-c74a91d49f6afea0b23acc4d5b4543dfee5e64db.tar.xz manaverse-c74a91d49f6afea0b23acc4d5b4543dfee5e64db.zip |
Allow drag & drop more than one amount at time in craft inventory.
Diffstat (limited to 'src/gui/widgets/itemcontainer.cpp')
-rw-r--r-- | src/gui/widgets/itemcontainer.cpp | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index af614bcb1..f274dcd11 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -41,8 +41,15 @@ #include "gui/windows/inventorywindow.h" #include "gui/windows/shopwindow.h" #include "gui/windows/shortcutwindow.h" +#ifdef EATHENA_SUPPORT +#include "gui/windows/itemamountwindow.h" +#include "gui/windows/npcdialog.h" +#endif #include "net/inventoryhandler.h" +#ifdef EATHENA_SUPPORT +#include "net/npchandler.h" +#endif #include "net/tradehandler.h" #include "utils/delete2.h" @@ -862,12 +869,24 @@ void ItemContainer::mouseReleased(MouseEvent &event) if (inventory) { Item *const item = inventory->getItem(dragDrop.getTag()); - if (mInventory->addVirtualItem( - item, - getSlotByXY(event.getX(), event.getY()), - 1)) + const int slot = getSlotByXY(event.getX(), event.getY()); + if (item->getQuantity() > 1) { - inventory->virtualRemove(item, 1); + ItemAmountWindow::showWindow(ItemAmountWindow::CraftAdd, + npcHandler->getCurrentNpcDialog(), + item, + 0, + slot); + } + else + { + if (mInventory->addVirtualItem( + item, + slot, + 1)) + { + inventory->virtualRemove(item, 1); + } } } return; |