summaryrefslogtreecommitdiff
path: root/src/net/messagein.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/messagein.cpp
parent45527f8597dfac68e914a798184282faeb1493f2 (diff)
downloadmv-de90520de303659fe639794544c2e19d462b3907.tar.gz
mv-de90520de303659fe639794544c2e19d462b3907.tar.bz2
mv-de90520de303659fe639794544c2e19d462b3907.tar.xz
mv-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/messagein.cpp')
-rw-r--r--src/net/messagein.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/net/messagein.cpp b/src/net/messagein.cpp
index 5b942a2d0..d5888534e 100644
--- a/src/net/messagein.cpp
+++ b/src/net/messagein.cpp
@@ -42,6 +42,8 @@ PRAGMA48(GCC diagnostic pop)
(CAST_U16((CAST_U8(low)) | \
(CAST_U16(CAST_U8(high))) << 8))
+extern int itemIdLen;
+
namespace Net
{
@@ -208,6 +210,13 @@ uint32_t MessageIn::readUInt32(const char *const str)
return value;
}
+int MessageIn::readItemId(const char *const str)
+{
+ if (itemIdLen == 2)
+ return readUInt16(str);
+ return readInt32(str);
+}
+
BeingId MessageIn::readBeingId(const char *const str)
{
return fromInt(readUInt32(str), BeingId);