summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2010-04-24 18:26:50 -0600
committerJared Adams <jaxad0127@gmail.com>2010-04-25 14:40:20 -0600
commit33481831b44f7e6fded6b9be29f1ea56bf74bfa2 (patch)
tree2dfe0010c0901152df357cf915b7cb48e13a8977
parentf07260b4a1c43611c0839b5adf735a2c13ad8348 (diff)
downloadmana-33481831b44f7e6fded6b9be29f1ea56bf74bfa2.tar.gz
mana-33481831b44f7e6fded6b9be29f1ea56bf74bfa2.tar.bz2
mana-33481831b44f7e6fded6b9be29f1ea56bf74bfa2.tar.xz
mana-33481831b44f7e6fded6b9be29f1ea56bf74bfa2.zip
Fix some storage bugs
Reviewed-by: Bertram
-rw-r--r--src/gui/inventorywindow.cpp30
-rw-r--r--src/gui/inventorywindow.h2
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.
*/