diff options
Diffstat (limited to 'src/inventory.cpp')
-rw-r--r-- | src/inventory.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/inventory.cpp b/src/inventory.cpp index c0ddd888..30763622 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -132,3 +132,16 @@ int Inventory::getNumberOfSlotsUsed() return NumberOfFilledSlot; } + +int Inventory::getLastUsedSlot() +{ + int i; + + for (i = INVENTORY_SIZE - 1; i >= 0; i--) { + if ((items[i].getId() != -1) && (items[i].getQuantity() > 0)) { + break; + } + } + + return --i; +} |