diff options
author | Andrei Karas <akaras@inbox.ru> | 2018-07-26 03:02:37 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2018-07-26 03:02:37 +0300 |
commit | 639148d9d301bd2dc20893fcf0571eb5c8e922f3 (patch) | |
tree | dd67dce5139b205820ae5d987fb7ff0a225df667 /src/net/messageout.cpp | |
parent | 45527f8597dfac68e914a798184282faeb1493f2 (diff) | |
download | plus-639148d9d301bd2dc20893fcf0571eb5c8e922f3.tar.gz plus-639148d9d301bd2dc20893fcf0571eb5c8e922f3.tar.bz2 plus-639148d9d301bd2dc20893fcf0571eb5c8e922f3.tar.xz plus-639148d9d301bd2dc20893fcf0571eb5c8e922f3.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/messageout.cpp')
-rw-r--r-- | src/net/messageout.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/net/messageout.cpp b/src/net/messageout.cpp index 69993e4d8..841e1183d 100644 --- a/src/net/messageout.cpp +++ b/src/net/messageout.cpp @@ -40,6 +40,8 @@ PRAGMA48(GCC diagnostic pop) #error missing SDL_endian.h #endif // SDL_BYTEORDER +extern int itemIdLen; + namespace Net { @@ -98,6 +100,15 @@ void MessageOut::writeInt32(const int32_t value, const char *const str) mPos += 4; } +void MessageOut::writeItemId(const int32_t value, + const char *const str) +{ + if (itemIdLen == 2) + writeInt16(CAST_S32(value), str); + else + writeInt32(value, str); +} + void MessageOut::writeInt64(const int64_t value, const char *const str) { DEBUGLOG2("writeInt64: " + toStringPrint(CAST_U32(value)), |