summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Dombrowski <stefan@uni-bonn.de>2010-09-11 19:27:17 +0200
committerStefan Dombrowski <stefan@uni-bonn.de>2010-09-11 19:27:17 +0200
commit29e9ff188f1d64705ce53e8196e97b5eef30a547 (patch)
tree78f35794b69b422133669790f2030de37ed407ac
parent7c883da9183238a0f1d75e2e815bc5f689956f14 (diff)
downloadmana-29e9ff188f1d64705ce53e8196e97b5eef30a547.tar.gz
mana-29e9ff188f1d64705ce53e8196e97b5eef30a547.tar.bz2
mana-29e9ff188f1d64705ce53e8196e97b5eef30a547.tar.xz
mana-29e9ff188f1d64705ce53e8196e97b5eef30a547.zip
Making sure the inventory window shows the correct number of used slots
The SlotsBar is updated, if InventoryWindow::slotsChanged() is called. This did not happen when an item disappeared from the inventory, because of using it. Then the item quantity was just set to 0, but the SlotBar was not notified. Reviewed-by: Jaxad0127
-rw-r--r--src/net/tmwa/inventoryhandler.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp
index f5b379b9..3809399d 100644
--- a/src/net/tmwa/inventoryhandler.cpp
+++ b/src/net/tmwa/inventoryhandler.cpp
@@ -270,7 +270,11 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
if (Item *item = inventory->getItem(index))
{
- item->setQuantity(amount);
+ if (amount)
+ item->setQuantity(amount);
+ else
+ inventory->removeItemAt(index);
+
inventoryWindow->updateButtons();
}
@@ -288,7 +292,11 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
{
if (Item *item = inventory->getItem(index))
{
- item->setQuantity(amount);
+ if (amount)
+ item->setQuantity(amount);
+ else
+ inventory->removeItemAt(index);
+
inventoryWindow->updateButtons();
}
}