diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-04-21 04:44:53 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-04-21 20:37:02 +0300 |
commit | 862e8f821789014b6167f37976b80694d6d310e3 (patch) | |
tree | 7c4d77a370f4da3d84a649b0d10e4d0a05725e6a /src/resources/inventory | |
parent | 62fa051ace7097e78134d46505070a70c08e128f (diff) | |
download | manaverse-862e8f821789014b6167f37976b80694d6d310e3.tar.gz manaverse-862e8f821789014b6167f37976b80694d6d310e3.tar.bz2 manaverse-862e8f821789014b6167f37976b80694d6d310e3.tar.xz manaverse-862e8f821789014b6167f37976b80694d6d310e3.zip |
Add item options into item and get it from server.
Diffstat (limited to 'src/resources/inventory')
-rw-r--r-- | src/resources/inventory/inventory.cpp | 14 | ||||
-rw-r--r-- | src/resources/inventory/inventory.h | 5 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/resources/inventory/inventory.cpp b/src/resources/inventory/inventory.cpp index 0f34ea977..ddc9acc1a 100644 --- a/src/resources/inventory/inventory.cpp +++ b/src/resources/inventory/inventory.cpp @@ -31,6 +31,7 @@ #include "resources/iteminfo.h" #include "resources/item/item.h" +#include "resources/item/itemoptionslist.h" #include "listeners/inventorylistener.h" @@ -204,6 +205,19 @@ void Inventory::setCards(const int index, item1->setCards(cards, size); } +void Inventory::setOptions(const int index, + const ItemOptionsList *const options) +{ + if (index < 0 || index >= CAST_S32(mSize)) + { + logger->log("Warning: invalid inventory index: %d", index); + return; + } + Item *const item1 = mItems[index]; + if (item1) + item1->setOptions(options); +} + void Inventory::clear() { for (unsigned i = 0; i < mSize; i++) diff --git a/src/resources/inventory/inventory.h b/src/resources/inventory/inventory.h index f4d275eae..5180e49e1 100644 --- a/src/resources/inventory/inventory.h +++ b/src/resources/inventory/inventory.h @@ -47,6 +47,8 @@ class InventoryListener; class Item; +struct ItemOptionsList; + class Inventory notfinal { public: @@ -121,6 +123,9 @@ class Inventory notfinal const int *const cards, const int size) const; + void setOptions(const int index, + const ItemOptionsList *const options); + void moveItem(const int index1, const int index2); |