summaryrefslogtreecommitdiff
path: root/src/net/messageout.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/messageout.cpp
parent45527f8597dfac68e914a798184282faeb1493f2 (diff)
downloadmanaverse-de90520de303659fe639794544c2e19d462b3907.tar.gz
manaverse-de90520de303659fe639794544c2e19d462b3907.tar.bz2
manaverse-de90520de303659fe639794544c2e19d462b3907.tar.xz
manaverse-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/messageout.cpp')
-rw-r--r--src/net/messageout.cpp11
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)),