summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2010-03-25 16:03:13 -0600
committerJared Adams <jaxad0127@gmail.com>2010-03-25 16:56:12 -0600
commit8745368108563d7c32820b989c3ea794ccb834f9 (patch)
treea69554b2e5659b25f50797cc6ab4cc95b2b6f84e /src/gui
parentac18a72c9972faf6dbd68abf3c883b2d444396c8 (diff)
downloadMana-8745368108563d7c32820b989c3ea794ccb834f9.tar.gz
Mana-8745368108563d7c32820b989c3ea794ccb834f9.tar.bz2
Mana-8745368108563d7c32820b989c3ea794ccb834f9.tar.xz
Mana-8745368108563d7c32820b989c3ea794ccb834f9.zip
Remove the type boolean from InventoryWindow
This moves inventory/storage type into the Inventory class, having size default to a call to the netcode to get the sive for the given type. Reviewed-by: Chuck Miller
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/inventorywindow.cpp16
-rw-r--r--src/gui/inventorywindow.h2
-rw-r--r--src/gui/itemamount.cpp8
-rw-r--r--src/gui/trade.cpp6
4 files changed, 15 insertions, 17 deletions
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index 41d0246c..26f12285 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -55,12 +55,12 @@
InventoryWindow::WindowList InventoryWindow::instances;
-InventoryWindow::InventoryWindow(Inventory *inventory, bool isMainInventory):
- Window(isMainInventory ? _("Inventory") : _("Storage")),
+InventoryWindow::InventoryWindow(Inventory *inventory):
+ Window(inventory->isMainInventory() ? _("Inventory") : _("Storage")),
mInventory(inventory),
mSplit(false)
{
- setWindowName(isMainInventory ? "Inventory" : "Storage");
+ setWindowName(inventory->isMainInventory() ? "Inventory" : "Storage");
setupWindow->registerWindowForReset(this);
setResizable(true);
setCloseButton(true);
@@ -80,7 +80,7 @@ InventoryWindow::InventoryWindow(Inventory *inventory, bool isMainInventory):
mSlotsLabel = new Label(_("Slots:"));
mSlotsBar = new ProgressBar(0.0f, 100, 20, Theme::PROG_INVY_SLOTS);
- if (isMainInventory)
+ if (inventory->isMainInventory())
{
std::string equip = _("Equip");
std::string use = _("Use");
@@ -137,7 +137,7 @@ InventoryWindow::InventoryWindow(Inventory *inventory, bool isMainInventory):
loadWindowState();
slotsChanged(mInventory);
- if (!isMainInventory)
+ if (!inventory->isMainInventory())
setVisible(true);
}
@@ -241,9 +241,9 @@ void InventoryWindow::mouseClicked(gcn::MouseEvent &event)
if(!item)
return;
- Net::getInventoryHandler()->moveItem(Net::InventoryHandler::INVENTORY,
+ Net::getInventoryHandler()->moveItem(Inventory::INVENTORY,
item->getInvIndex(), item->getQuantity(),
- Net::InventoryHandler::STORAGE);
+ Inventory::STORAGE);
}
}
}
@@ -326,7 +326,7 @@ void InventoryWindow::close()
if (this == inventoryWindow)
return;
- Net::getInventoryHandler()->closeStorage(Net::InventoryHandler::STORAGE);
+ Net::getInventoryHandler()->closeStorage(Inventory::STORAGE);
scheduleDelete();
}
diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h
index 406c24bf..948482f5 100644
--- a/src/gui/inventorywindow.h
+++ b/src/gui/inventorywindow.h
@@ -53,7 +53,7 @@ class InventoryWindow : public Window,
/**
* Constructor.
*/
- InventoryWindow(Inventory *inventory, bool isMainInventory = false);
+ InventoryWindow(Inventory *inventory);
/**
* Destructor.
diff --git a/src/gui/itemamount.cpp b/src/gui/itemamount.cpp
index f28bbed7..a98a67ab 100644
--- a/src/gui/itemamount.cpp
+++ b/src/gui/itemamount.cpp
@@ -53,14 +53,14 @@ void ItemAmountWindow::finish(Item *item, int amount, Usage usage)
Net::getInventoryHandler()->splitItem(item, amount);
break;
case StoreAdd:
- Net::getInventoryHandler()->moveItem(Net::InventoryHandler::INVENTORY,
+ Net::getInventoryHandler()->moveItem(Inventory::INVENTORY,
item->getInvIndex(), amount,
- Net::InventoryHandler::STORAGE);
+ Inventory::STORAGE);
break;
case StoreRemove:
- Net::getInventoryHandler()->moveItem(Net::InventoryHandler::STORAGE,
+ Net::getInventoryHandler()->moveItem(Inventory::STORAGE,
item->getInvIndex(), amount,
- Net::InventoryHandler::INVENTORY);
+ Inventory::INVENTORY);
break;
default:
break;
diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp
index 0f86913a..dcb38e8e 100644
--- a/src/gui/trade.cpp
+++ b/src/gui/trade.cpp
@@ -56,10 +56,8 @@
TradeWindow::TradeWindow():
Window(_("Trade: You")),
- mMyInventory(new Inventory(Net::getInventoryHandler()
- ->getSize(Net::InventoryHandler::INVENTORY))),
- mPartnerInventory(new Inventory(Net::getInventoryHandler()
- ->getSize(Net::InventoryHandler::INVENTORY))),
+ mMyInventory(new Inventory(Inventory::TRADE)),
+ mPartnerInventory(new Inventory(Inventory::TRADE)),
mStatus(PROPOSING)
{
setWindowName("Trade");