summaryrefslogtreecommitdiff
path: root/src/net/eathena
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/eathena')
-rw-r--r--src/net/eathena/messagein.cpp19
-rw-r--r--src/net/eathena/messagein.h2
2 files changed, 21 insertions, 0 deletions
diff --git a/src/net/eathena/messagein.cpp b/src/net/eathena/messagein.cpp
index 60d89980d..db3eb1889 100644
--- a/src/net/eathena/messagein.cpp
+++ b/src/net/eathena/messagein.cpp
@@ -85,4 +85,23 @@ int32_t MessageIn::readInt32(const char *const str)
return value;
}
+int64_t MessageIn::readInt64(const char *const str)
+{
+ int32_t value = -1;
+ if (mPos + 8 <= mLength)
+ {
+#if SDL_BYTEORDER == SDL_BIG_ENDIAN
+ int64_t swap;
+ memcpy(&swap, mData + static_cast<size_t>(mPos), sizeof(int64_t));
+ value = SDL_Swap64(swap);
+#else
+ memcpy(&value, mData + static_cast<size_t>(mPos), sizeof(int64_t));
+#endif
+ }
+ DEBUGLOG2("readInt64: " + toStringPrint(value), mPos, str);
+ mPos += 8;
+ PacketCounters::incInBytes(8);
+ return value;
+}
+
} // namespace EAthena
diff --git a/src/net/eathena/messagein.h b/src/net/eathena/messagein.h
index 3c267a888..1b9001c64 100644
--- a/src/net/eathena/messagein.h
+++ b/src/net/eathena/messagein.h
@@ -51,6 +51,8 @@ class MessageIn final : public Net::MessageIn
int16_t readInt16(const char *const str = nullptr);
/**< Reads a long. */
int32_t readInt32(const char *const str = nullptr);
+
+ int64_t readInt64(const char *const str = nullptr);
};
} // namespace EAthena