diff options
author | Yohann Ferreira <bertram@cegetel.net> | 2005-04-13 18:47:04 +0000 |
---|---|---|
committer | Yohann Ferreira <bertram@cegetel.net> | 2005-04-13 18:47:04 +0000 |
commit | 4b7cbd2a0ade9f40714194d59dc5bc7836778344 (patch) | |
tree | 603c2622ee828c3d8765aed6b157b002918302c2 /src/gui/itemcontainer.cpp | |
parent | d741206cc1751ffbbf1909271d66558572358bfc (diff) | |
download | mana-4b7cbd2a0ade9f40714194d59dc5bc7836778344.tar.gz mana-4b7cbd2a0ade9f40714194d59dc5bc7836778344.tar.bz2 mana-4b7cbd2a0ade9f40714194d59dc5bc7836778344.tar.xz mana-4b7cbd2a0ade9f40714194d59dc5bc7836778344.zip |
Now getNumberOfSlotsUsed() return the number of different items a character has.
Diffstat (limited to 'src/gui/itemcontainer.cpp')
-rw-r--r-- | src/gui/itemcontainer.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp index 616eb0f5..1de08b57 100644 --- a/src/gui/itemcontainer.cpp +++ b/src/gui/itemcontainer.cpp @@ -216,3 +216,18 @@ void ItemContainer::setEquipment(int index, bool equipment) { items[index].equipment = equipment; } + +int ItemContainer::getNumberOfSlotsUsed() +{ + int NumberOfFilledSlot = 0; + for (int i = 0; i < INVENTORY_SIZE; i++) + { + if (items[i].quantity > 0) + { + NumberOfFilledSlot++; + } + } + + return NumberOfFilledSlot; +} + |