From 59e483ca6d2ec680f438787b4b3213534380c871 Mon Sep 17 00:00:00 2001 From: Guillaume Melquiond Date: Thu, 4 Jan 2007 23:30:57 +0000 Subject: Simplified, completed, and documented a bit the Inventory class. --- src/game-server/inventory.hpp | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'src/game-server/inventory.hpp') 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); }; -- cgit v1.2.3-60-g2f50