diff options
author | Aaron Marks <nymacro@gmail.com> | 2005-05-05 09:18:49 +0000 |
---|---|---|
committer | Aaron Marks <nymacro@gmail.com> | 2005-05-05 09:18:49 +0000 |
commit | 27c42e6505a99a0464361aca0fb6e23dce9b863e (patch) | |
tree | 8fe77671450a7dde25872685d35e78b7eb9759f2 /src | |
parent | 974678ef41977c899c2d9229c0aae905e019ecdd (diff) | |
download | mana-27c42e6505a99a0464361aca0fb6e23dce9b863e.tar.gz mana-27c42e6505a99a0464361aca0fb6e23dce9b863e.tar.bz2 mana-27c42e6505a99a0464361aca0fb6e23dce9b863e.tar.xz mana-27c42e6505a99a0464361aca0fb6e23dce9b863e.zip |
- Equipped items now listed in inventory as "Eq.".
- Depending on whether selected inventory is equipment or item the button
which was previously only labeled "Use" will be labelled either: "Use",
"Equip" or "Unequip".
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/inventory.cpp | 21 | ||||
-rw-r--r-- | src/gui/inventory.h | 1 | ||||
-rw-r--r-- | src/gui/itemcontainer.cpp | 2 |
3 files changed, 21 insertions, 3 deletions
diff --git a/src/gui/inventory.cpp b/src/gui/inventory.cpp index 73a98575..397a7e39 100644 --- a/src/gui/inventory.cpp +++ b/src/gui/inventory.cpp @@ -37,9 +37,7 @@ InventoryWindow::InventoryWindow(): { setContentSize(322, 100); useButton = new Button("Use"); - useButton->setPosition(8, getHeight() - 48); dropButton = new Button("Drop"); - dropButton->setPosition(40, getHeight() - 48); items = new ItemContainer(); items->setPosition(2, 2); @@ -61,6 +59,7 @@ InventoryWindow::InventoryWindow(): setMinHeight(96); updateWidgets(); + useButton->setSize(48, useButton->getHeight()); } InventoryWindow::~InventoryWindow() @@ -157,6 +156,22 @@ void InventoryWindow::action(const std::string &eventId) } } +void InventoryWindow::mouseClick(int x, int y, int button, int count) +{ + Window::mouseClick(x, y, button, count); + + //differentiate items & equipment + if (items->getIndex() != -1) { + if (items->isEquipment(items->getIndex())) + if (items->isEquipped(items->getIndex())) + useButton->setCaption("Unequip"); + else + useButton->setCaption("Equip"); + else + useButton ->setCaption("Use"); + } +} + void InventoryWindow::mouseMotion(int mx, int my) { int tmpWidth = getWidth(), tmpHeight = getHeight(); @@ -170,7 +185,7 @@ void InventoryWindow::updateWidgets() { //resize widgets useButton->setPosition(8, getHeight() - 24); - dropButton->setPosition(40, getHeight() - 24); + dropButton->setPosition(48 + 16, getHeight() - 24); items->setSize(getWidth() - 24 - 12 - 1, (INVENTORY_SIZE * 24) / (getWidth() / 24) - 1); invenScroll->setSize(getWidth() - 16, getHeight() - 32 - 8); setContentSize(getWidth(), getHeight()); diff --git a/src/gui/inventory.h b/src/gui/inventory.h index f4e814f0..89262d52 100644 --- a/src/gui/inventory.h +++ b/src/gui/inventory.h @@ -88,6 +88,7 @@ class InventoryWindow : public Window, gcn::ActionListener { int dropItem(int index, int quantity); + void mouseClick(int x, int y, int button, int count); void mouseMotion(int mx, int my); ItemContainer *items; diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp index 61e9383f..fd3020d4 100644 --- a/src/gui/itemcontainer.cpp +++ b/src/gui/itemcontainer.cpp @@ -89,6 +89,8 @@ void ItemContainer::draw(gcn::Graphics* graphics) std::stringstream ss; if(!items[i].equipped) ss << items[i].quantity; + else + ss << "Eq."; graphics->drawText(ss.str(), itemX + 12, itemY + 16, |