diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-08-24 21:40:32 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-08-24 21:40:32 +0300 |
commit | af5fde1f88bd5c8d0e11b59d73f6c76610c14acf (patch) | |
tree | fa96240f6134843ccfb6b281ba8c32fead8f3cd8 /src/resources/inventory/inventory.cpp | |
parent | f2f123e95adc6aa6a1a81bef0414705df30986e3 (diff) | |
download | manaplus-af5fde1f88bd5c8d0e11b59d73f6c76610c14acf.tar.gz manaplus-af5fde1f88bd5c8d0e11b59d73f6c76610c14acf.tar.bz2 manaplus-af5fde1f88bd5c8d0e11b59d73f6c76610c14acf.tar.xz manaplus-af5fde1f88bd5c8d0e11b59d73f6c76610c14acf.zip |
Add into inventory method for set tag to item at given index.
Diffstat (limited to 'src/resources/inventory/inventory.cpp')
-rw-r--r-- | src/resources/inventory/inventory.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/resources/inventory/inventory.cpp b/src/resources/inventory/inventory.cpp index b7aa39e91..dd88da99c 100644 --- a/src/resources/inventory/inventory.cpp +++ b/src/resources/inventory/inventory.cpp @@ -220,6 +220,20 @@ void Inventory::setOptions(const int index, item1->setOptions(options); } +void Inventory::setTag(const int index, + const int tag) +{ + if (index < 0 || index >= CAST_S32(mSize)) + { + reportAlways("Warning: invalid inventory index: %d", + index); + return; + } + Item *const item1 = mItems[index]; + if (item1 != nullptr) + item1->setTag(tag); +} + void Inventory::clear() { for (unsigned i = 0; i < mSize; i++) |