summaryrefslogtreecommitdiff
path: root/src/net/eathena/buyingstorehandler.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-07-26 03:02:37 +0300
committerAndrei Karas <akaras@inbox.ru>2018-07-26 22:01:35 +0300
commitde90520de303659fe639794544c2e19d462b3907 (patch)
tree36b306a26e2c9dd422aede36f2f9ca3158ffbae2 /src/net/eathena/buyingstorehandler.cpp
parent45527f8597dfac68e914a798184282faeb1493f2 (diff)
downloadplus-de90520de303659fe639794544c2e19d462b3907.tar.gz
plus-de90520de303659fe639794544c2e19d462b3907.tar.bz2
plus-de90520de303659fe639794544c2e19d462b3907.tar.xz
plus-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/buyingstorehandler.cpp')
-rw-r--r--src/net/eathena/buyingstorehandler.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/net/eathena/buyingstorehandler.cpp b/src/net/eathena/buyingstorehandler.cpp
index 44a63a658..3a5bfb9d3 100644
--- a/src/net/eathena/buyingstorehandler.cpp
+++ b/src/net/eathena/buyingstorehandler.cpp
@@ -35,6 +35,7 @@
#include "debug.h"
extern int packetVersion;
+extern int itemIdLen;
namespace EAthena
{
@@ -57,14 +58,14 @@ void BuyingStoreHandler::create(const std::string &name,
if (packetVersion < 20100303)
return;
createOutPacket(CMSG_BUYINGSTORE_CREATE);
- outMsg.writeInt16(CAST_S16(89 + items.size() * 8), "len");
+ outMsg.writeInt16(CAST_S16(89 + items.size() * (6 + itemIdLen)), "len");
outMsg.writeInt32(maxMoney, "limit money");
outMsg.writeInt8(static_cast<int8_t>(flag), "flag");
outMsg.writeString(name, 80, "store name");
FOR_EACH (STD_VECTOR<ShopItem*>::const_iterator, it, items)
{
const ShopItem *const item = *it;
- outMsg.writeInt16(CAST_S16(item->getId()), "item id");
+ outMsg.writeItemId(item->getId(), "item id");
outMsg.writeInt16(CAST_S16(item->getQuantity()), "amount");
outMsg.writeInt32(item->getPrice(), "price");
}
@@ -105,7 +106,7 @@ void BuyingStoreHandler::sell(const Being *const being,
outMsg.writeInt16(CAST_S16(
item->getInvIndex() + INVENTORY_OFFSET),
"index");
- outMsg.writeInt16(CAST_S16(item->getId()), "item id");
+ outMsg.writeItemId(item->getId(), "item id");
outMsg.writeInt16(CAST_S16(amount), "amount");
}