summaryrefslogtreecommitdiff
path: root/src/gui/inventory.cpp
diff options
context:
space:
mode:
authorEugenio Favalli <elvenprogrammer@gmail.com>2005-02-20 11:32:50 +0000
committerEugenio Favalli <elvenprogrammer@gmail.com>2005-02-20 11:32:50 +0000
commit3135c725cc37251943271cd8f939e646c9164259 (patch)
tree159ae31b1c0518d37f5bb21344fe3c72bf5cc382 /src/gui/inventory.cpp
parent54a359f67da79d97df667299ea4d91cef79c08f2 (diff)
downloadmana-3135c725cc37251943271cd8f939e646c9164259.tar.gz
mana-3135c725cc37251943271cd8f939e646c9164259.tar.bz2
mana-3135c725cc37251943271cd8f939e646c9164259.tar.xz
mana-3135c725cc37251943271cd8f939e646c9164259.zip
Finally equipment! Sometimes it works :P
Diffstat (limited to 'src/gui/inventory.cpp')
-rw-r--r--src/gui/inventory.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/gui/inventory.cpp b/src/gui/inventory.cpp
index db5dfb54..67d6fecb 100644
--- a/src/gui/inventory.cpp
+++ b/src/gui/inventory.cpp
@@ -124,13 +124,28 @@ void InventoryWindow::equipItem(int index) {
while ((out_size > 0)) flush();
}
+void InventoryWindow::unequipItem(int index) {
+ WFIFOW(0) = net_w_value(0x00ab);
+ WFIFOW(2) = net_w_value(index);
+ WFIFOSET(4);
+ while ((out_size > 0)) flush();
+
+}
+
void InventoryWindow::action(const std::string &eventId)
{
//if(selectedItem >= 0 && selectedItem <= INVENTORY_SIZE) {
if (items->getIndex() != -1) {
if (eventId == "use") {
if(items->isEquipment(items->getIndex())) {
- equipItem(items->getIndex());
+ if(items->isEquipped(items->getIndex())) {
+ unequipItem(items->getIndex());
+ std::cout << "Blah\n";
+
+ }
+ else {
+ equipItem(items->getIndex());
+ }
}
else {
useItem(items->getIndex(), items->getId());
@@ -138,7 +153,7 @@ void InventoryWindow::action(const std::string &eventId)
}
else if (eventId == "drop") {
dropItem(items->getIndex(), items->getQuantity());
- // Temp: drop all the items, you should choose quantity instead
+ // TODO: now drop all the items, you should choose quantity instead
}
}
}