diff options
author | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2007-01-04 23:30:57 +0000 |
---|---|---|
committer | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2007-01-04 23:30:57 +0000 |
commit | 59e483ca6d2ec680f438787b4b3213534380c871 (patch) | |
tree | 0b84196d7a4ca9ffb3e38a444add5c84d99942f1 /src/game-server/inventory.hpp | |
parent | 57f3805466e67a279e64427302798b29690b2a45 (diff) | |
download | manaserv-59e483ca6d2ec680f438787b4b3213534380c871.tar.gz manaserv-59e483ca6d2ec680f438787b4b3213534380c871.tar.bz2 manaserv-59e483ca6d2ec680f438787b4b3213534380c871.tar.xz manaserv-59e483ca6d2ec680f438787b4b3213534380c871.zip |
Simplified, completed, and documented a bit the Inventory class.
Diffstat (limited to 'src/game-server/inventory.hpp')
-rw-r--r-- | src/game-server/inventory.hpp | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/src/game-server/inventory.hpp b/src/game-server/inventory.hpp index 3640abc3..950dc013 100644 --- a/src/game-server/inventory.hpp +++ b/src/game-server/inventory.hpp @@ -94,16 +94,42 @@ class Inventory */ int remove(int itemId, int amount); - int countItem(int itemId); + /** + * Removes some items from inventory. + * @return number of items not removed. + */ + int removeFromSlot(int slot, int amount); + + /** + * Counts number of items with given ID. + */ + int count(int itemId); + + /** + * Gets the ID of the items in a given slot. + */ + int getItem(int slot); + private: /** * Fills some slots with items. * @return number of items not inserted. */ int fillFreeSlot(int itemId, int amount, int MaxPerSlot); + + /** + * Frees an inventory slot given by its real index. + */ void freeIndex(int index); - int getItem(int slot); + + /** + * Gets the real index associated to a slot. + */ int getIndex(int slot); + + /** + * Gets the slot number of an inventory index. + */ int getSlot(int index); }; |