summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-09-14 06:45:40 -0600
committerJared Adams <jaxad0127@gmail.com>2009-09-14 06:45:40 -0600
commit96ca40bdc307be0a527d1c98edffdb1bc4c85f8f (patch)
tree6cbf7f82374c5a82fe44a33c39165adf38cb668e /src
parentc5e7ba2e373466fcbe884c1579acd6ea5a8f5222 (diff)
downloadmana-96ca40bdc307be0a527d1c98edffdb1bc4c85f8f.tar.gz
mana-96ca40bdc307be0a527d1c98edffdb1bc4c85f8f.tar.bz2
mana-96ca40bdc307be0a527d1c98edffdb1bc4c85f8f.tar.xz
mana-96ca40bdc307be0a527d1c98edffdb1bc4c85f8f.zip
Fix context menu for items in the EquipmentWindow
Diffstat (limited to 'src')
-rw-r--r--src/equipment.cpp4
-rw-r--r--src/gui/equipmentwindow.cpp2
-rw-r--r--src/item.cpp2
-rw-r--r--src/item.h11
-rw-r--r--src/net/ea/inventoryhandler.cpp3
5 files changed, 19 insertions, 3 deletions
diff --git a/src/equipment.cpp b/src/equipment.cpp
index 41722300..76382528 100644
--- a/src/equipment.cpp
+++ b/src/equipment.cpp
@@ -51,5 +51,9 @@ void Equipment::setEquipment(int index, int id, int quantity)
mEquipment[index] = (id > 0) ? new Item(id, quantity) : 0;
if (mEquipment[index])
+ {
mEquipment[index]->setInvIndex(index);
+ mEquipment[index]->setEquipped(true);
+ mEquipment[index]->setInEquipment(true);
+ }
}
diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp
index 25de201c..2fd7ccad 100644
--- a/src/gui/equipmentwindow.cpp
+++ b/src/gui/equipmentwindow.cpp
@@ -205,7 +205,7 @@ void EquipmentWindow::mousePressed(gcn::MouseEvent& mouseEvent)
*/
const int mx = x + getX();
const int my = y + getY();
- viewport->showPopup(mx, my, item);
+ viewport->showPopup(mx, my, item, true);
}
}
}
diff --git a/src/item.cpp b/src/item.cpp
index 312a7f63..46905e5c 100644
--- a/src/item.cpp
+++ b/src/item.cpp
@@ -28,7 +28,7 @@
Item::Item(int id, int quantity, bool equipment, bool equipped):
mImage(0),
mQuantity(quantity),
- mEquipment(equipment), mEquipped(equipped)
+ mEquipment(equipment), mEquipped(equipped), mInEquipment(false)
{
setId(id);
}
diff --git a/src/item.h b/src/item.h
index 0e27aa4c..56995eb6 100644
--- a/src/item.h
+++ b/src/item.h
@@ -94,6 +94,16 @@ class Item
bool isEquipped() const { return mEquipped; }
/**
+ * Sets whether this item is in equipment.
+ */
+ void setInEquipment(bool inEquipment) { mInEquipment = inEquipment; }
+
+ /**
+ * Returns whether this item is in equipment.
+ */
+ bool isInEquipment() const { return mInEquipment; }
+
+ /**
* Sets the inventory index of this item.
*/
void setInvIndex(int index) { mInvIndex = index; }
@@ -114,6 +124,7 @@ class Item
int mQuantity; /**< Number of items. */
bool mEquipment; /**< Item is equipment. */
bool mEquipped; /**< Item is equipped. */
+ bool mInEquipment; /**< Item is in equipment */
int mInvIndex; /**< Inventory index. */
};
diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp
index b6e91609..55714a70 100644
--- a/src/net/ea/inventoryhandler.cpp
+++ b/src/net/ea/inventoryhandler.cpp
@@ -304,7 +304,8 @@ void InventoryHandler::equipItem(const Item *item)
void InventoryHandler::unequipItem(const Item *item)
{
- const Item *real_item = item->isEquipped() ? item : getRealEquipedItem(item);
+ const Item *real_item = item->isInEquipment() ? getRealEquipedItem(item)
+ : item;
if (!real_item)
return;