summaryrefslogtreecommitdiff
path: root/src/net/eathena/vendingrecv.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-04-21 04:44:53 +0300
committerAndrei Karas <akaras@inbox.ru>2017-04-21 20:37:02 +0300
commit862e8f821789014b6167f37976b80694d6d310e3 (patch)
tree7c4d77a370f4da3d84a649b0d10e4d0a05725e6a /src/net/eathena/vendingrecv.cpp
parent62fa051ace7097e78134d46505070a70c08e128f (diff)
downloadmanaplus-862e8f821789014b6167f37976b80694d6d310e3.tar.gz
manaplus-862e8f821789014b6167f37976b80694d6d310e3.tar.bz2
manaplus-862e8f821789014b6167f37976b80694d6d310e3.tar.xz
manaplus-862e8f821789014b6167f37976b80694d6d310e3.zip
Add item options into item and get it from server.
Diffstat (limited to 'src/net/eathena/vendingrecv.cpp')
-rw-r--r--src/net/eathena/vendingrecv.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/net/eathena/vendingrecv.cpp b/src/net/eathena/vendingrecv.cpp
index 119e5ffa9..bf0cd20eb 100644
--- a/src/net/eathena/vendingrecv.cpp
+++ b/src/net/eathena/vendingrecv.cpp
@@ -48,6 +48,7 @@
#include "resources/inventory/inventory.h"
+#include "resources/item/itemoptionslist.h"
#include "resources/item/shopitem.h"
#include "utils/gettext.h"
@@ -125,13 +126,16 @@ void VendingRecv::processItemsList(Net::MessageIn &msg)
msg.readUInt8("refine");
for (int d = 0; d < maxCards; d ++)
cards[d] = msg.readUInt16("card");
+ ItemOptionsList *options = nullptr;
if (msg.getVersion() >= 20150226)
{
+ options = new ItemOptionsList;
for (int d = 0; d < 5; d ++)
{
- msg.readInt16("option index");
- msg.readInt16("option value");
+ const uint16_t idx = msg.readInt16("option index");
+ const uint16_t val = msg.readInt16("option value");
msg.readUInt8("option param");
+ options->add(idx, val);
}
}
@@ -139,7 +143,11 @@ void VendingRecv::processItemsList(Net::MessageIn &msg)
ShopItem *const item = mBuyDialog->addItem(itemId, type,
color, amount, value);
if (item)
+ {
item->setInvIndex(index);
+ item->setOptions(options);
+ }
+ delete options;
}
mBuyDialog->sort();
}