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.cpp18
1 files changed, 3 insertions, 15 deletions
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index 372e94d3..027c6aa8 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -174,20 +174,12 @@ void InventoryWindow::action(const gcn::ActionEvent &event)
}
else if (event.getId() == "drop")
{
- if (item->getQuantity() > 1) {
- // Choose amount of items to drop
- new ItemAmountWindow(ItemAmountWindow::ItemDrop, this, item);
- }
- else {
- player_node->dropItem(item, 1);
- }
+ ItemAmountWindow::showWindow(ItemAmountWindow::ItemDrop, this, item);
}
else if (event.getId() == "split")
{
- if (item && !item->isEquipment() && item->getQuantity() > 1) {
- new ItemAmountWindow(ItemAmountWindow::ItemSplit, this, item,
+ ItemAmountWindow::showWindow(ItemAmountWindow::ItemSplit, this, item,
(item->getQuantity() - 1));
- }
}
}
@@ -244,12 +236,8 @@ void InventoryWindow::valueChanged(const gcn::SelectionEvent &event)
{
Item *item = mItems->getSelectedItem();
- if (item && !item->isEquipment() && item->getQuantity() > 1)
- {
- mSplit = false;
- new ItemAmountWindow(ItemAmountWindow::ItemSplit, this, item,
+ ItemAmountWindow::showWindow(ItemAmountWindow::ItemSplit, this, item,
(item->getQuantity() - 1));
- }
}
}