diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/equipment.cpp | 4 | ||||
-rw-r--r-- | src/gui/equipmentwindow.cpp | 2 | ||||
-rw-r--r-- | src/item.cpp | 2 | ||||
-rw-r--r-- | src/item.h | 11 | ||||
-rw-r--r-- | src/net/ea/inventoryhandler.cpp | 3 |
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); } @@ -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; |