From 7ddd8f2894267d6cc3827c41b7cb609380bdcf45 Mon Sep 17 00:00:00 2001 From: Alexander Batalov Date: Wed, 5 Oct 2022 15:44:00 +0300 Subject: [PATCH] Fix itemGetQuantity --- src/item.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/item.cc b/src/item.cc index 735f635..a75aa08 100644 --- a/src/item.cc +++ b/src/item.cc @@ -1029,11 +1029,15 @@ int itemGetQuantity(Object* obj, Object* item) InventoryItem* inventoryItem = &(inventory->items[index]); if (inventoryItem->item == item) { quantity = inventoryItem->quantity; + + // SFALL: Fix incorrect value being returned if there is a container + // item in the inventory. + break; } else { if (itemGetType(inventoryItem->item) == ITEM_TYPE_CONTAINER) { quantity = itemGetQuantity(inventoryItem->item, item); if (quantity > 0) { - return quantity; + break; } } }