Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/inventory.cc10
-rw-r--r--src/core/inventory.h5
2 files changed, 15 insertions, 0 deletions
diff --git a/src/core/inventory.cc b/src/core/inventory.cc
index 645ddf8..e079256 100644
--- a/src/core/inventory.cc
+++ b/src/core/inventory.cc
@@ -93,6 +93,16 @@ void Inventory::erase(const unsigned int id)
}
}
+Item *Inventory::find(Item *item) const
+{
+ for (Items::const_iterator it = inventory_items.begin(); it != inventory_items.end(); it++) {
+ if ((*it) == item) {
+ return item;
+ }
+ }
+ return 0;
+}
+
Item *Inventory::find(const Info *info) const
{
// sarch the inventory for a specified item type
diff --git a/src/core/inventory.h b/src/core/inventory.h
index 3c3adfa..4ea8350 100644
--- a/src/core/inventory.h
+++ b/src/core/inventory.h
@@ -101,6 +101,11 @@ public:
* @brief search the inventory for a specific item id
*/
Item *find(const unsigned int id) const;
+
+ /**
+ * @brief search the inventory for a specific item
+ */
+ Item *find(Item *item) const;
/* ---- mutators --------------------------------------------------- */