diff options
author | Nikos Giagtzoglou <gnikos21@yahoo.gr> | 2008-11-22 11:43:53 +0100 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2008-11-22 11:43:53 +0100 |
commit | 991389a535985af072f830b89e5113da82650fe5 (patch) | |
tree | 071ec4153b820a9c6404d5845443403b3cda83fb /src/gui | |
parent | c79d12b91ef0e49878a8e3f10486b910184acc69 (diff) | |
download | mana-client-991389a535985af072f830b89e5113da82650fe5.tar.gz mana-client-991389a535985af072f830b89e5113da82650fe5.tar.bz2 mana-client-991389a535985af072f830b89e5113da82650fe5.tar.xz mana-client-991389a535985af072f830b89e5113da82650fe5.zip |
Inventory window now displays amount of slots used
Patch by Nikos, with some improvements by vargavind.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/inventorywindow.cpp | 19 | ||||
-rw-r--r-- | src/gui/inventorywindow.h | 1 |
2 files changed, 16 insertions, 4 deletions
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index d01a2112..6a5a8b37 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -24,11 +24,11 @@ #include <string> #include <guichan/mouseinput.hpp> - #include <guichan/widgets/label.hpp> #include "button.h" #include "gui.h" +#include "inventory.h" #include "item_amount.h" #include "itemcontainer.h" #include "scrollarea.h" @@ -64,10 +64,13 @@ InventoryWindow::InventoryWindow(): mItemNameLabel = new gcn::Label("Name:"); mItemDescriptionLabel = new gcn::Label("Description:"); mItemEffectLabel = new gcn::Label("Effect:"); - mWeightLabel = new gcn::Label("Total Weight: - Maximum Weight: "); + mWeightLabel = new gcn::Label("Weight:"); mWeightLabel->setPosition(8, 8); mInvenScroll->setPosition(8, mWeightLabel->getY() + mWeightLabel->getHeight() + 5); + mInvenSlotLabel = new gcn::Label("Slots used:"); + mInvenSlotLabel->setPosition(mWeightLabel->getX() + + mWeightLabel->getWidth() + 100, 8); add(mUseButton); add(mDropButton); @@ -76,6 +79,7 @@ InventoryWindow::InventoryWindow(): add(mItemDescriptionLabel); add(mItemEffectLabel); add(mWeightLabel); + add(mInvenSlotLabel); mUseButton->setSize(60, mUseButton->getHeight()); @@ -92,8 +96,14 @@ void InventoryWindow::logic() // Update weight information mWeightLabel->setCaption( - "Total Weight: " + toString(player_node->mTotalWeight) + " - " - "Maximum Weight: " + toString(player_node->mMaxWeight)); + "Weight: " + toString(player_node->mTotalWeight) + + "/" + toString(player_node->mMaxWeight)); + + // Update number of items in inventory + mInvenSlotLabel->setCaption( + "Slots used: " + + toString(player_node->getInventory()->getNumberOfSlotsUsed()) + + "/" + toString(player_node->getInventory()->getInventorySize())); } void InventoryWindow::action(const gcn::ActionEvent &event) @@ -201,6 +211,7 @@ void InventoryWindow::widgetResized(const gcn::Event &event) mItemDescriptionLabel->getY() - mWeightLabel->getHeight() - 18); mWeightLabel->setWidth(width - 16); + mInvenSlotLabel->setWidth(width - 16); } void InventoryWindow::updateButtons() diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h index 0b208bbb..b1e3ede3 100644 --- a/src/gui/inventorywindow.h +++ b/src/gui/inventorywindow.h @@ -84,6 +84,7 @@ class InventoryWindow : public Window, gcn::ActionListener, gcn::Label *mItemDescriptionLabel; gcn::Label *mItemEffectLabel; gcn::Label *mWeightLabel; + gcn::Label *mInvenSlotLabel; }; extern InventoryWindow *inventoryWindow; |