summaryrefslogtreecommitdiff
path: root/src/gui/inventory.cpp
diff options
context:
space:
mode:
authorAaron Marks <nymacro@gmail.com>2005-05-05 09:18:49 +0000
committerAaron Marks <nymacro@gmail.com>2005-05-05 09:18:49 +0000
commit27c42e6505a99a0464361aca0fb6e23dce9b863e (patch)
tree8fe77671450a7dde25872685d35e78b7eb9759f2 /src/gui/inventory.cpp
parent974678ef41977c899c2d9229c0aae905e019ecdd (diff)
downloadmana-client-27c42e6505a99a0464361aca0fb6e23dce9b863e.tar.gz
mana-client-27c42e6505a99a0464361aca0fb6e23dce9b863e.tar.bz2
mana-client-27c42e6505a99a0464361aca0fb6e23dce9b863e.tar.xz
mana-client-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/gui/inventory.cpp')
-rw-r--r--src/gui/inventory.cpp21
1 files changed, 18 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());