diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-08-11 19:51:54 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-08-11 19:51:54 +0300 |
commit | 0210c6c6358fa4664b935e4345c96f752b03776c (patch) | |
tree | 1a3151acf7d3948fcc063b792b4c33be0eface52 /src | |
parent | 58de724683af04b627fbe5fb435b8771c77cdf50 (diff) | |
download | ManaVerse-0210c6c6358fa4664b935e4345c96f752b03776c.tar.gz ManaVerse-0210c6c6358fa4664b935e4345c96f752b03776c.tar.bz2 ManaVerse-0210c6c6358fa4664b935e4345c96f752b03776c.tar.xz ManaVerse-0210c6c6358fa4664b935e4345c96f752b03776c.zip |
Add function for send int64 fields into network.
Diffstat (limited to 'src')
-rw-r--r-- | src/net/eathena/messageout.cpp | 17 | ||||
-rw-r--r-- | src/net/eathena/messageout.h | 3 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/net/eathena/messageout.cpp b/src/net/eathena/messageout.cpp index a04b5edad..086d9f446 100644 --- a/src/net/eathena/messageout.cpp +++ b/src/net/eathena/messageout.cpp @@ -86,6 +86,23 @@ void MessageOut::writeInt32(const int32_t value, const char *const str) PacketCounters::incOutBytes(4); } +void MessageOut::writeInt64(const int64_t value, const char *const str) +{ + DEBUGLOG2("writeInt64: " + toStringPrint(CAST_U32(value)), + mPos, str); + expand(8); +#if SDL_BYTEORDER == SDL_BIG_ENDIAN + int32_t swap = SDL_Swap64(value); + memcpy(mData + CAST_SIZE(mPos), &swap, sizeof(int64_t)); +#else // SDL_BYTEORDER == SDL_BIG_ENDIAN + + memcpy(mData + CAST_SIZE(mPos), &value, sizeof(int64_t)); +#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN + + mPos += 8; + PacketCounters::incOutBytes(8); +} + void MessageOut::writeBeingId(const BeingId value, const char *const str) { writeInt32(toInt(value, int32_t), str); diff --git a/src/net/eathena/messageout.h b/src/net/eathena/messageout.h index 01728873b..2c07d5cff 100644 --- a/src/net/eathena/messageout.h +++ b/src/net/eathena/messageout.h @@ -55,6 +55,9 @@ class MessageOut final : public Net::MessageOut void writeInt32(const int32_t value, const char *const str) override final; + void writeInt64(const int64_t value, + const char *const str); + void writeBeingId(const BeingId value, const char *const str) override final; |