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/messagein.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/messagein.cpp')
-rw-r--r-- | src/net/messagein.cpp | 9 |
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); |