summaryrefslogtreecommitdiff
path: root/src/resources/inventory/inventory.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-09-05 01:03:01 +0300
committerAndrei Karas <akaras@inbox.ru>2017-09-05 01:03:01 +0300
commit9e48f292f14fe96c98b5cfe18a32bcb1bc3d7c24 (patch)
treeb4c985f231f965b2d6a024058c79202b8b7553d6 /src/resources/inventory/inventory.cpp
parentc80c18c42249407a386fd6b484597e03acc32437 (diff)
downloadmv-9e48f292f14fe96c98b5cfe18a32bcb1bc3d7c24.tar.gz
mv-9e48f292f14fe96c98b5cfe18a32bcb1bc3d7c24.tar.bz2
mv-9e48f292f14fe96c98b5cfe18a32bcb1bc3d7c24.tar.xz
mv-9e48f292f14fe96c98b5cfe18a32bcb1bc3d7c24.zip
Fix adding stackable items to mail.
Diffstat (limited to 'src/resources/inventory/inventory.cpp')
-rw-r--r--src/resources/inventory/inventory.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/resources/inventory/inventory.cpp b/src/resources/inventory/inventory.cpp
index 7363bdd30..d256ea9ac 100644
--- a/src/resources/inventory/inventory.cpp
+++ b/src/resources/inventory/inventory.cpp
@@ -420,6 +420,21 @@ int Inventory::findIndexByTag(const int tag) const
return -1;
}
+Item *Inventory::findItemByTag(const int tag) const
+{
+ for (unsigned i = 0; i < mSize; i++)
+ {
+ Item *const item = mItems[i];
+ if (item != nullptr &&
+ item->mTag == tag)
+ {
+ return item;
+ }
+ }
+
+ return nullptr;
+}
+
bool Inventory::addVirtualItem(const Item *const item,
int index,
const int amount)