diff options
author | Stijn Buys <ingar@osirion.org> | 2013-11-05 12:02:13 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2013-11-05 12:02:13 +0000 |
commit | cbb34af067be07ad28349e64d8670c97785c53c0 (patch) | |
tree | 98a0c7ae49b839be00809e9cfa21a5bb8b55c032 /src/core/inventory.cc | |
parent | 1c9a974d65db676a61ae99e6e426e95671af056e (diff) |
Added core:: method to find an item pointer in an inventory.
Diffstat (limited to 'src/core/inventory.cc')
-rw-r--r-- | src/core/inventory.cc | 10 |
1 files changed, 10 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 |