diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2008-06-12 09:06:01 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2008-06-12 09:06:01 +0000 |
commit | 2f8ee95fbacb71e7cbca85fcc11e6f9f7e36c258 (patch) | |
tree | 8d256ac1a38932aaf0db7b55ed178e4212616555 /src/inventory.h | |
parent | eb019ab915998a3ec247b33dad4b23f763d7a29a (diff) | |
download | mana-2f8ee95fbacb71e7cbca85fcc11e6f9f7e36c258.tar.gz mana-2f8ee95fbacb71e7cbca85fcc11e6f9f7e36c258.tar.bz2 mana-2f8ee95fbacb71e7cbca85fcc11e6f9f7e36c258.tar.xz mana-2f8ee95fbacb71e7cbca85fcc11e6f9f7e36c258.zip |
Merged revisions 3738 via svnmerge from
https://themanaworld.svn.sourceforge.net/svnroot/themanaworld/tmw/trunk
........
r3738 | b_lindeijer | 2007-11-16 00:44:01 +0100 (Fri, 16 Nov 2007) | 3 lines
Moved item icon from ItemInfo class to the Item class, so that it can be loaded
on demand. Results in faster startup time and reduced memory usage.
........
Diffstat (limited to 'src/inventory.h')
-rw-r--r-- | src/inventory.h | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/inventory.h b/src/inventory.h index d5c3cf35..0d2bbc5a 100644 --- a/src/inventory.h +++ b/src/inventory.h @@ -44,7 +44,15 @@ class Inventory /** * Returns the item at the specified index. */ - Item* getItem(int index); + Item* getItem(int index) const; + + /** + * Searches for the specified item by it's id. + * + * @param itemId The id of the item to be searched. + * @return Item found on success, NULL on failure. + */ + Item* findItem(int itemId) const; /** * Adds a new item in a free slot. @@ -52,9 +60,9 @@ class Inventory void addItem(int id, int quantity, bool equipment); /** - * Adds a new item at a given position. + * Sets the item at the given position. */ - void addItem(int index, int id, int quantity, bool equipment); + void setItem(int index, int id, int quantity, bool equipment); /** * Remove a item from the inventory. @@ -62,9 +70,14 @@ class Inventory void removeItem(int id); /** + * Remove the item at the specified index from the inventory. + */ + void removeItemAt(int index); + + /** * Checks if the given item is in the inventory */ - bool contains(Item *item); + bool contains(Item *item) const; /** * Returns id of next free slot or -1 if all occupied. @@ -87,7 +100,7 @@ class Inventory int getLastUsedSlot(); protected: - Item *mItems; /**< The holder of items */ + Item **mItems; /**< The holder of items */ }; #endif |