summaryrefslogtreecommitdiff
path: root/src/gui/widgets/itemcontainer.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-08-20 19:02:40 +0300
committerAndrei Karas <akaras@inbox.ru>2015-08-20 19:02:40 +0300
commit2b0936e4eafee4da5e2ff3c0a7b7fd0df8a9f5c4 (patch)
tree2f6157ee1268ea2ea978e8949126ef010ff682ff /src/gui/widgets/itemcontainer.cpp
parentd7f5bf6c2ad9fdcf2308b1c9d3a70e0f17b30adf (diff)
downloadmv-2b0936e4eafee4da5e2ff3c0a7b7fd0df8a9f5c4.tar.gz
mv-2b0936e4eafee4da5e2ff3c0a7b7fd0df8a9f5c4.tar.bz2
mv-2b0936e4eafee4da5e2ff3c0a7b7fd0df8a9f5c4.tar.xz
mv-2b0936e4eafee4da5e2ff3c0a7b7fd0df8a9f5c4.zip
Add ability for insert cards into items by dragging.
Diffstat (limited to 'src/gui/widgets/itemcontainer.cpp')
-rw-r--r--src/gui/widgets/itemcontainer.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index e728cb3a4..b533aadd3 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -36,6 +36,7 @@
#include "gui/popups/itempopup.h"
#include "gui/windows/chatwindow.h"
+#include "gui/windows/inventorywindow.h"
#include "gui/windows/shopwindow.h"
#include "gui/windows/shortcutwindow.h"
@@ -579,6 +580,18 @@ void ItemContainer::mouseReleased(MouseEvent &event)
dstContainer = InventoryType::CART;
inventory = PlayerInfo::getInventory();
}
+ if (src == DRAGDROP_SOURCE_INVENTORY
+ && dst == DRAGDROP_SOURCE_INVENTORY)
+ {
+ const int index = getSlotIndex(event.getX(), event.getY());
+ if (index == Inventory::NO_SLOT_INDEX)
+ return;
+ if (index == mSelectedIndex || mSelectedIndex == -1)
+ return;
+ if (inventoryWindow)
+ inventoryWindow->combineItems(index, mSelectedIndex);
+ return;
+ }
else if (src == DRAGDROP_SOURCE_CART
&& dst == DRAGDROP_SOURCE_INVENTORY)
{