From c74a91d49f6afea0b23acc4d5b4543dfee5e64db Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 8 Jan 2016 23:07:23 +0300 Subject: Allow drag & drop more than one amount at time in craft inventory. --- src/gui/windows/npcdialog.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/gui/windows/npcdialog.cpp') diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp index 66cdc4bb3..2fcb53468 100644 --- a/src/gui/windows/npcdialog.cpp +++ b/src/gui/windows/npcdialog.cpp @@ -1370,3 +1370,24 @@ std::string NpcDialog::complexItemToStr(const ComplexItem *const item) } return str; } + +void NpcDialog::addCraftItem(Item *const item, + const int amount, + const int slot) +{ + if (mInputState != NPC_INPUT_ITEM_CRAFT) + return; + + Inventory *const inventory = PlayerInfo::getInventory(); + + if (!inventory) + return; + + if (mComplexInventory->addVirtualItem( + item, + slot, + amount)) + { + inventory->virtualRemove(item, amount); + } +} -- cgit v1.2.3-70-g09d2