diff options
-rw-r--r-- | src/gui/inventorywindow.cpp | 30 | ||||
-rw-r--r-- | src/gui/inventorywindow.h | 2 |
2 files changed, 17 insertions, 15 deletions
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index f214fde5..591ebd2f 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -60,7 +60,7 @@ InventoryWindow::InventoryWindow(Inventory *inventory): mInventory(inventory), mSplit(false) { - setWindowName(inventory->isMainInventory() ? "Inventory" : "Storage"); + setWindowName(isMainInventory() ? "Inventory" : "Storage"); setupWindow->registerWindowForReset(this); setResizable(true); setCloseButton(true); @@ -80,7 +80,7 @@ InventoryWindow::InventoryWindow(Inventory *inventory): mSlotsLabel = new Label(_("Slots:")); mSlotsBar = new ProgressBar(0.0f, 100, 20, Theme::PROG_INVY_SLOTS); - if (inventory->isMainInventory()) + if (isMainInventory()) { std::string equip = _("Equip"); std::string use = _("Use"); @@ -137,7 +137,7 @@ InventoryWindow::InventoryWindow(Inventory *inventory): loadWindowState(); slotsChanged(mInventory); - if (!inventory->isMainInventory()) + if (!isMainInventory()) setVisible(true); } @@ -158,6 +158,17 @@ void InventoryWindow::action(const gcn::ActionEvent &event) outfitWindow->requestMoveToTop(); } } + else if (event.getId() == "store") + { + if (!inventoryWindow->isVisible()) return; + + Item *item = inventoryWindow->getSelectedItem(); + + if (!item) + return; + + ItemAmountWindow::showWindow(ItemAmountWindow::StoreAdd, this, item); + } Item *item = mItems->getSelectedItem(); @@ -185,17 +196,6 @@ void InventoryWindow::action(const gcn::ActionEvent &event) ItemAmountWindow::showWindow(ItemAmountWindow::ItemSplit, this, item, (item->getQuantity() - 1)); } - else if (event.getId() == "store") - { - if (!inventoryWindow->isVisible()) return; - - Item *item = inventoryWindow->getSelectedItem(); - - if (!item) - return; - - ItemAmountWindow::showWindow(ItemAmountWindow::StoreAdd, this, item); - } else if (event.getId() == "retrieve") { Item *item = mItems->getSelectedItem(); @@ -229,7 +229,7 @@ void InventoryWindow::mouseClicked(gcn::MouseEvent &event) */ const int mx = event.getX() + getX(); const int my = event.getY() + getY(); - viewport->showPopup(this, mx, my, item); + viewport->showPopup(this, mx, my, item, isMainInventory()); } if (event.getButton() == gcn::MouseEvent::LEFT) diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h index 948482f5..f611e934 100644 --- a/src/gui/inventorywindow.h +++ b/src/gui/inventorywindow.h @@ -108,6 +108,8 @@ class InventoryWindow : public Window, void slotsChanged(Inventory* inventory); + bool isMainInventory() { return mInventory->isMainInventory(); } + /** * Returns true if any instances exist. */ |