diff options
-rw-r--r-- | src/net/eathena/maprecv.cpp | 6 | ||||
-rw-r--r-- | src/net/messagein.cpp | 16 | ||||
-rw-r--r-- | src/net/messagein.h | 2 |
3 files changed, 21 insertions, 3 deletions
diff --git a/src/net/eathena/maprecv.cpp b/src/net/eathena/maprecv.cpp index e37932a25..ff0bdec44 100644 --- a/src/net/eathena/maprecv.cpp +++ b/src/net/eathena/maprecv.cpp @@ -69,9 +69,9 @@ void MapRecv::processCameraInfo(Net::MessageIn &msg) { UNIMPLEMENTEDPACKET; msg.readUInt8("action"); - msg.readInt32("range"); - msg.readInt32("rotation"); - msg.readInt32("latitude"); + msg.readFloat("range"); + msg.readFloat("rotation"); + msg.readFloat("latitude"); } } // namespace EAthena diff --git a/src/net/messagein.cpp b/src/net/messagein.cpp index c7544c7d5..bdac098c5 100644 --- a/src/net/messagein.cpp +++ b/src/net/messagein.cpp @@ -246,6 +246,22 @@ int64_t MessageIn::readInt64(const char *const str) return value; } +float MessageIn::readFloat(const char *const str) +{ + float value = 0; + if (mPos + 4 <= mLength) + { + memcpy(&value, mData + CAST_SIZE(mPos), sizeof(float)); + } +#ifdef ENABLEDEBUGLOG + std::string text = strprintf("readFloat: %f", value); + DEBUGLOG2(str, mPos, text.c_str()); +#endif + mPos += 4; + PacketCounters::incInBytes(4); + return value; +} + uint8_t MessageIn::fromServerDirection(const uint8_t serverDir) { // Translate from eAthena format diff --git a/src/net/messagein.h b/src/net/messagein.h index 89a73fd4b..97be4ff72 100644 --- a/src/net/messagein.h +++ b/src/net/messagein.h @@ -86,6 +86,8 @@ class MessageIn notfinal BeingId readBeingId(const char *const str); + float readFloat(const char *const str); + /** * Reads a special 3 byte block used by eAthena, containing x and y * coordinates and direction. |