summaryrefslogtreecommitdiff
path: root/src/net/tmwa/inventoryhandler.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com>2010-09-25 03:15:26 +0200
committerThorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com>2010-09-25 03:15:26 +0200
commit661d16e98c62dfff40f481177bf3f1a0c58c2124 (patch)
treea415866c4c94a0a0c53045a47220ca413ae9c5c9 /src/net/tmwa/inventoryhandler.cpp
parent758d80263b1647c712c0e0cdd3dfca9945a1bb7e (diff)
parent7d0738df0d139af3175fcc1fec5b9be4a467f4f4 (diff)
downloadmana-661d16e98c62dfff40f481177bf3f1a0c58c2124.tar.gz
mana-661d16e98c62dfff40f481177bf3f1a0c58c2124.tar.bz2
mana-661d16e98c62dfff40f481177bf3f1a0c58c2124.tar.xz
mana-661d16e98c62dfff40f481177bf3f1a0c58c2124.zip
Merge branch '1.0'
Conflicts: src/actorspritemanager.h src/beingmanager.cpp src/game.cpp src/gui/beingpopup.cpp src/gui/chat.cpp src/gui/chat.h src/gui/inventorywindow.h src/gui/itempopup.cpp src/gui/socialwindow.cpp src/gui/statuswindow.cpp src/gui/widgets/chattab.cpp src/gui/widgets/chattab.h src/net/tmwa/inventoryhandler.cpp src/net/tmwa/partyhandler.cpp src/party.cpp src/sound.cpp src/utils/stringutils.cpp src/utils/stringutils.h
Diffstat (limited to 'src/net/tmwa/inventoryhandler.cpp')
-rw-r--r--src/net/tmwa/inventoryhandler.cpp25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp
index 4a46e475..9fac8e8c 100644
--- a/src/net/tmwa/inventoryhandler.cpp
+++ b/src/net/tmwa/inventoryhandler.cpp
@@ -130,6 +130,7 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
int index, amount, itemId, equipType, arrow;
int identified, cards[4], itemType;
Inventory *inventory = PlayerInfo::getInventory();
+ PlayerInfo::getEquipment()->setBackend(&mEquips);
switch (msg.getId())
{
@@ -139,8 +140,6 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
{
// Clear inventory - this will be a complete refresh
mEquips.clear();
- PlayerInfo::getEquipment()->setBackend(&mEquips);
-
inventory->clear();
}
else
@@ -242,6 +241,8 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
inventory->setItem(index, itemId, amount);
}
+
+ inventoryWindow->updateButtons();
} break;
case SMSG_PLAYER_INVENTORY_REMOVE:
@@ -252,6 +253,7 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
item->increaseQuantity(-amount);
if (item->getQuantity() == 0)
inventory->removeItemAt(index);
+ inventoryWindow->updateButtons();
}
break;
@@ -263,7 +265,15 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
msg.readInt8(); // type
if (Item *item = inventory->getItem(index))
- item->setQuantity(amount);
+ {
+ if (amount)
+ item->setQuantity(amount);
+ else
+ inventory->removeItemAt(index);
+
+ inventoryWindow->updateButtons();
+ }
+
break;
case SMSG_ITEM_USE_RESPONSE:
@@ -277,7 +287,14 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
else
{
if (Item *item = inventory->getItem(index))
- item->setQuantity(amount);
+ {
+ if (amount)
+ item->setQuantity(amount);
+ else
+ inventory->removeItemAt(index);
+
+ inventoryWindow->updateButtons();
+ }
}
break;