From 7e4ee66042ca97b870b073225da9a02c95e35c5e Mon Sep 17 00:00:00 2001 From: iProgramInCpp Date: Fri, 4 Aug 2023 11:35:03 +0300 Subject: [PATCH] * Clear a slot if amount is zero. --- source/Inventory.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/Inventory.cpp b/source/Inventory.cpp index 9016ff7..efdd64b 100644 --- a/source/Inventory.cpp +++ b/source/Inventory.cpp @@ -180,6 +180,9 @@ ItemInstance* Inventory::getItem(int slotNo) if (slotNo < 0 || slotNo >= int(m_items.size())) return nullptr; + if (m_items[slotNo].m_amount <= 0) + m_items[slotNo].m_itemID = 0; + return &m_items[slotNo]; }