summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gui/widgets/itemcontainer.cpp36
1 files changed, 35 insertions, 1 deletions
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index 528e751fb..0ca5231e1 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -423,6 +423,9 @@ void ItemContainer::mousePressed(MouseEvent &event)
case InventoryType::NPC:
src = DRAGDROP_SOURCE_NPC;
break;
+ case InventoryType::CART:
+ src = DRAGDROP_SOURCE_CART;
+ break;
default:
break;
}
@@ -518,6 +521,9 @@ void ItemContainer::mouseReleased(MouseEvent &event)
case InventoryType::NPC:
dst = DRAGDROP_SOURCE_NPC;
break;
+ case InventoryType::CART:
+ dst = DRAGDROP_SOURCE_CART;
+ break;
default:
break;
}
@@ -540,6 +546,34 @@ void ItemContainer::mouseReleased(MouseEvent &event)
inventory = PlayerInfo::getStorageInventory();
}
if (src == DRAGDROP_SOURCE_INVENTORY
+ && dst == DRAGDROP_SOURCE_CART)
+ {
+ srcContainer = InventoryType::INVENTORY;
+ dstContainer = InventoryType::CART;
+ inventory = PlayerInfo::getInventory();
+ }
+ else if (src == DRAGDROP_SOURCE_CART
+ && dst == DRAGDROP_SOURCE_INVENTORY)
+ {
+ srcContainer = InventoryType::CART;
+ dstContainer = InventoryType::INVENTORY;
+ inventory = PlayerInfo::getCartInventory();
+ }
+ else if (src == DRAGDROP_SOURCE_CART
+ && dst == DRAGDROP_SOURCE_STORAGE)
+ {
+ srcContainer = InventoryType::CART;
+ dstContainer = InventoryType::STORAGE;
+ inventory = PlayerInfo::getCartInventory();
+ }
+ else if (src == DRAGDROP_SOURCE_STORAGE
+ && dst == DRAGDROP_SOURCE_CART)
+ {
+ srcContainer = InventoryType::STORAGE;
+ dstContainer = InventoryType::CART;
+ inventory = PlayerInfo::getStorageInventory();
+ }
+ if (src == DRAGDROP_SOURCE_INVENTORY
&& dst == DRAGDROP_SOURCE_TRADE)
{
checkProtection = true;
@@ -575,7 +609,7 @@ void ItemContainer::mouseReleased(MouseEvent &event)
if (item)
{
if (srcContainer != -1)
- { // inventory <--> storage
+ { // inventory <--> storage, cart
inventoryHandler->moveItem2(srcContainer,
item->getInvIndex(), item->getQuantity(),
dstContainer);