summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gui/windows/inventorywindow.cpp35
-rw-r--r--src/gui/windows/itemamountwindow.cpp16
-rw-r--r--src/gui/windows/itemamountwindow.h2
3 files changed, 47 insertions, 6 deletions
diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp
index 535f87f59..36bcc64ac 100644
--- a/src/gui/windows/inventorywindow.cpp
+++ b/src/gui/windows/inventorywindow.cpp
@@ -384,7 +384,16 @@ void InventoryWindow::action(const ActionEvent &event)
if (!item)
return;
- ItemAmountWindow::showWindow(ItemAmountWindow::StoreAdd, this, item);
+ if (storageWindow)
+ {
+ ItemAmountWindow::showWindow(ItemAmountWindow::StoreAdd,
+ this, item);
+ }
+ else if (cartWindow)
+ {
+ ItemAmountWindow::showWindow(ItemAmountWindow::CartAdd,
+ this, item);
+ }
}
else if (eventId == "sort")
{
@@ -422,8 +431,14 @@ void InventoryWindow::action(const ActionEvent &event)
if (isStorageActive())
{
inventoryHandler->moveItem2(InventoryType::INVENTORY,
- item->getInvIndex(), item->getQuantity(),
- InventoryType::STORAGE);
+ item->getInvIndex(), item->getQuantity(),
+ InventoryType::STORAGE);
+ }
+ else if (cartWindow)
+ {
+ inventoryHandler->moveItem2(InventoryType::INVENTORY,
+ item->getInvIndex(), item->getQuantity(),
+ InventoryType::CART);
}
else
{
@@ -449,8 +464,16 @@ void InventoryWindow::action(const ActionEvent &event)
}
else if (eventId == "retrieve")
{
- ItemAmountWindow::showWindow(ItemAmountWindow::StoreRemove,
- this, item);
+ if (storageWindow)
+ {
+ ItemAmountWindow::showWindow(ItemAmountWindow::StoreRemove,
+ this, item);
+ }
+ else if (cartWindow)
+ {
+ ItemAmountWindow::showWindow(ItemAmountWindow::CartRemove,
+ this, item);
+ }
}
}
@@ -773,7 +796,7 @@ void InventoryWindow::updateDropButton()
if (!mDropButton)
return;
- if (isStorageActive())
+ if (isStorageActive() || cartWindow)
{
// TRANSLATORS: inventory button
mDropButton->setCaption(_("Store"));
diff --git a/src/gui/windows/itemamountwindow.cpp b/src/gui/windows/itemamountwindow.cpp
index 19d18eef8..5b714774c 100644
--- a/src/gui/windows/itemamountwindow.cpp
+++ b/src/gui/windows/itemamountwindow.cpp
@@ -72,10 +72,18 @@ void ItemAmountWindow::finish(const Item *const item,
inventoryHandler->moveItem2(InventoryType::INVENTORY,
item->getInvIndex(), amount, InventoryType::STORAGE);
break;
+ case CartAdd:
+ inventoryHandler->moveItem2(InventoryType::INVENTORY,
+ item->getInvIndex(), amount, InventoryType::CART);
+ break;
case StoreRemove:
inventoryHandler->moveItem2(InventoryType::STORAGE,
item->getInvIndex(), amount, InventoryType::INVENTORY);
break;
+ case CartRemove:
+ inventoryHandler->moveItem2(InventoryType::CART,
+ item->getInvIndex(), amount, InventoryType::INVENTORY);
+ break;
case ShopBuyAdd:
if (shopWindow)
shopWindow->addBuyItem(item, amount, price);
@@ -225,10 +233,18 @@ ItemAmountWindow::ItemAmountWindow(const Usage usage, Window *const parent,
// TRANSLATORS: amount window message
setCaption(_("Select amount of items to store."));
break;
+ case CartAdd:
+ // TRANSLATORS: amount window message
+ setCaption(_("Select amount of items to store to cart."));
+ break;
case StoreRemove:
// TRANSLATORS: amount window message
setCaption(_("Select amount of items to retrieve."));
break;
+ case CartRemove:
+ // TRANSLATORS: amount window message
+ setCaption(_("Select amount of items to retrieve from cart."));
+ break;
case ItemSplit:
// TRANSLATORS: amount window message
setCaption(_("Select amount of items to split."));
diff --git a/src/gui/windows/itemamountwindow.h b/src/gui/windows/itemamountwindow.h
index 22c0151ad..a82809730 100644
--- a/src/gui/windows/itemamountwindow.h
+++ b/src/gui/windows/itemamountwindow.h
@@ -52,6 +52,8 @@ class ItemAmountWindow final : public Window,
ItemDrop,
StoreAdd,
StoreRemove,
+ CartAdd,
+ CartRemove,
ItemSplit,
ShopBuyAdd,
ShopSellAdd