summaryrefslogtreecommitdiff
path: root/src/gui/inventorywindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/inventorywindow.cpp')
-rw-r--r--src/gui/inventorywindow.cpp54
1 files changed, 38 insertions, 16 deletions
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index 056afee92..132f9cb87 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -307,19 +307,22 @@ void InventoryWindow::action(const gcn::ActionEvent &event)
{
if (isStorageActive())
{
- Item *item = mItems->getSelectedItem();
-
- if (!item)
- return;
-
Net::getInventoryHandler()->moveItem(Inventory::INVENTORY,
item->getInvIndex(), item->getQuantity(),
Inventory::STORAGE);
}
else
{
- ItemAmountWindow::showWindow(ItemAmountWindow::ItemDrop,
- this, item);
+ if (keyboard.isKeyActive(keyboard.KEY_MOD))
+ {
+ Net::getInventoryHandler()->dropItem(
+ item, item->getQuantity());
+ }
+ else
+ {
+ ItemAmountWindow::showWindow(ItemAmountWindow::ItemDrop,
+ this, item);
+ }
}
}
else if (event.getId() == "split")
@@ -348,7 +351,9 @@ void InventoryWindow::mouseClicked(gcn::MouseEvent &event)
{
Window::mouseClicked(event);
- if (event.getButton() == gcn::MouseEvent::RIGHT)
+ bool mod = (isStorageActive() && keyboard.isKeyActive(keyboard.KEY_MOD));
+
+ if (!mod && event.getButton() == gcn::MouseEvent::RIGHT)
{
Item *item = mItems->getSelectedItem();
@@ -365,9 +370,10 @@ void InventoryWindow::mouseClicked(gcn::MouseEvent &event)
viewport->showPopup(this, mx, my, item, isMainInventory());
}
- if (event.getButton() == gcn::MouseEvent::LEFT)
+ if (event.getButton() == gcn::MouseEvent::LEFT
+ || event.getButton() == gcn::MouseEvent::RIGHT)
{
- if (isStorageActive() && keyboard.isKeyActive(keyboard.KEY_EMOTE))
+ if (mod)
{
Item *item = mItems->getSelectedItem();
@@ -376,15 +382,31 @@ void InventoryWindow::mouseClicked(gcn::MouseEvent &event)
if (mInventory->isMainInventory())
{
- Net::getInventoryHandler()->moveItem(Inventory::INVENTORY,
- item->getInvIndex(), item->getQuantity(),
- Inventory::STORAGE);
+ if (event.getButton() == gcn::MouseEvent::RIGHT)
+ {
+ ItemAmountWindow::showWindow(ItemAmountWindow::StoreAdd,
+ inventoryWindow, item);
+ }
+ else
+ {
+ Net::getInventoryHandler()->moveItem(Inventory::INVENTORY,
+ item->getInvIndex(), item->getQuantity(),
+ Inventory::STORAGE);
+ }
}
else
{
- Net::getInventoryHandler()->moveItem(Inventory::STORAGE,
- item->getInvIndex(), item->getQuantity(),
- Inventory::INVENTORY);
+ if (event.getButton() == gcn::MouseEvent::RIGHT)
+ {
+ ItemAmountWindow::showWindow(ItemAmountWindow::StoreRemove,
+ inventoryWindow, item);
+ }
+ else
+ {
+ Net::getInventoryHandler()->moveItem(Inventory::STORAGE,
+ item->getInvIndex(), item->getQuantity(),
+ Inventory::INVENTORY);
+ }
}
}
}