From 29e9ff188f1d64705ce53e8196e97b5eef30a547 Mon Sep 17 00:00:00 2001 From: Stefan Dombrowski Date: Sat, 11 Sep 2010 19:27:17 +0200 Subject: 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 --- src/net/tmwa/inventoryhandler.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') 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(); } } -- cgit v1.2.3-70-g09d2