summaryrefslogtreecommitdiff
path: root/src/inventory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/inventory.cpp')
-rw-r--r--src/inventory.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/inventory.cpp b/src/inventory.cpp
index d346a50b..da9aed02 100644
--- a/src/inventory.cpp
+++ b/src/inventory.cpp
@@ -50,7 +50,7 @@ Inventory::~Inventory()
Item* Inventory::getItem(int index) const
{
- if (index < 0 || index >= mSize)
+ if (index < 0 || index >= INVENTORY_SIZE || !mItems[index] || mItems[index]->getQuantity() <= 0)
return 0;
return mItems[index];
@@ -146,3 +146,8 @@ int Inventory::getLastUsedSlot() const
return -1;
}
+
+int Inventory::getInventorySize() const
+{
+ return INVENTORY_SIZE - 2;
+}