diff options
author | Andrei Karas <akaras@inbox.ru> | 2019-01-25 22:50:36 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2019-01-25 22:50:36 +0300 |
commit | 4e2ceec09d767063ade469e6cb810a06d1e6249d (patch) | |
tree | 816045142bf3a5a742820f5d52ae2364c42f22d6 | |
parent | 4dfe76eebcd1e09ca0ed3dc0d08669885cab5b99 (diff) | |
download | plus-4e2ceec09d767063ade469e6cb810a06d1e6249d.tar.gz plus-4e2ceec09d767063ade469e6cb810a06d1e6249d.tar.bz2 plus-4e2ceec09d767063ade469e6cb810a06d1e6249d.tar.xz plus-4e2ceec09d767063ade469e6cb810a06d1e6249d.zip |
Update packet SMSG_CAMERA_INFO
-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. |