summaryrefslogtreecommitdiff
path: root/src/net/eathena/traderecv.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/traderecv.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/traderecv.cpp')
-rw-r--r--src/net/eathena/traderecv.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/net/eathena/traderecv.cpp b/src/net/eathena/traderecv.cpp
index 03dcf62a6..2dcacc609 100644
--- a/src/net/eathena/traderecv.cpp
+++ b/src/net/eathena/traderecv.cpp
@@ -38,6 +38,7 @@
#include "resources/inventory/inventory.h"
#include "resources/item/item.h"
+#include "resources/item/itemoptionslist.h"
#include "debug.h"
@@ -87,13 +88,16 @@ void TradeRecv::processTradeItemAdd(Net::MessageIn &msg)
int cards[maxCards];
for (int f = 0; f < maxCards; f++)
cards[f] = msg.readUInt16("card");
+ ItemOptionsList *options = nullptr;
if (msg.getVersion() >= 20150226)
{
+ options = new ItemOptionsList;
for (int f = 0; f < 5; f ++)
{
- 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);
}
}
@@ -108,6 +112,7 @@ void TradeRecv::processTradeItemAdd(Net::MessageIn &msg)
tradeWindow->addItem2(type,
itemType,
cards,
+ options,
4,
false,
amount,
@@ -119,6 +124,7 @@ void TradeRecv::processTradeItemAdd(Net::MessageIn &msg)
Equipm_false);
}
}
+ delete options;
}
void TradeRecv::processTradeItemAddResponse(Net::MessageIn &msg)
@@ -139,6 +145,7 @@ void TradeRecv::processTradeItemAddResponse(Net::MessageIn &msg)
tradeWindow->addItem2(item->getId(),
item->getType(),
item->getCards(),
+ item->getOptions(),
4,
true,
mQuantity,