diff options
author | Andrei Karas <akaras@inbox.ru> | 2018-07-26 03:02:37 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2018-07-26 22:01:35 +0300 |
commit | de90520de303659fe639794544c2e19d462b3907 (patch) | |
tree | 36b306a26e2c9dd422aede36f2f9ca3158ffbae2 /src/net/eathena/marketrecv.cpp | |
parent | 45527f8597dfac68e914a798184282faeb1493f2 (diff) | |
download | manaplus-de90520de303659fe639794544c2e19d462b3907.tar.gz manaplus-de90520de303659fe639794544c2e19d462b3907.tar.bz2 manaplus-de90520de303659fe639794544c2e19d462b3907.tar.xz manaplus-de90520de303659fe639794544c2e19d462b3907.zip |
Add support for changed item id size in packets.
From some packet version hercules support item id fields as int32.
Diffstat (limited to 'src/net/eathena/marketrecv.cpp')
-rw-r--r-- | src/net/eathena/marketrecv.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/net/eathena/marketrecv.cpp b/src/net/eathena/marketrecv.cpp index 54947ccaa..c2d310193 100644 --- a/src/net/eathena/marketrecv.cpp +++ b/src/net/eathena/marketrecv.cpp @@ -42,6 +42,8 @@ #include "debug.h" +extern int itemIdLen; + namespace EAthena { @@ -53,7 +55,7 @@ namespace MarketRecv void MarketRecv::processMarketOpen(Net::MessageIn &msg) { - const int len = (msg.readInt16("len") - 4) / 13; + const int len = (msg.readInt16("len") - 4) / (11 + itemIdLen); const BeingTypeId npcId = NpcRecv::mNpcTypeId; std::string currency; @@ -78,7 +80,7 @@ void MarketRecv::processMarketOpen(Net::MessageIn &msg) for (int f = 0; f < len; f ++) { - const int itemId = msg.readInt16("item id"); + const int itemId = msg.readItemId("item id"); const ItemTypeT type = static_cast<ItemTypeT>(msg.readUInt8("type")); const int value = msg.readInt32("price"); const int amount = msg.readInt32("amount"); @@ -91,11 +93,11 @@ void MarketRecv::processMarketOpen(Net::MessageIn &msg) void MarketRecv::processMarketBuyAck(Net::MessageIn &msg) { - const int len = (msg.readInt16("len") - 5) / 8; + const int len = (msg.readInt16("len") - 5) / (6 + itemIdLen); const int res = msg.readUInt8("result"); for (int f = 0; f < len; f ++) { - msg.readInt16("item id"); + msg.readItemId("item id"); msg.readInt16("amount"); msg.readInt32("price"); } |