From 11d80e856811ceddec805ce68b0a17b13f5cf25e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 1 Sep 2014 12:38:59 +0300 Subject: In debug packets logging also display offset. --- src/net/eathena/messagein.cpp | 5 +++-- src/net/eathena/messageout.cpp | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'src/net/eathena') diff --git a/src/net/eathena/messagein.cpp b/src/net/eathena/messagein.cpp index e3918dd3a..60d89980d 100644 --- a/src/net/eathena/messagein.cpp +++ b/src/net/eathena/messagein.cpp @@ -59,9 +59,10 @@ int16_t MessageIn::readInt16(const char *const str) memcpy(&value, mData + static_cast(mPos), sizeof(int16_t)); #endif } + DEBUGLOG2("readInt16: " + toStringPrint(static_cast(value)), + mPos, str); mPos += 2; PacketCounters::incInBytes(2); - DEBUGLOG2("readInt16: " + toStringPrint(static_cast(value)), str); return value; } @@ -78,9 +79,9 @@ int32_t MessageIn::readInt32(const char *const str) memcpy(&value, mData + static_cast(mPos), sizeof(int32_t)); #endif } + DEBUGLOG2("readInt32: " + toStringPrint(value), mPos, str); mPos += 4; PacketCounters::incInBytes(4); - DEBUGLOG2("readInt32: " + toStringPrint(value), str); return value; } diff --git a/src/net/eathena/messageout.cpp b/src/net/eathena/messageout.cpp index 7c5d328cb..1b0dae6f1 100644 --- a/src/net/eathena/messageout.cpp +++ b/src/net/eathena/messageout.cpp @@ -57,7 +57,6 @@ void MessageOut::expand(const size_t bytes) void MessageOut::writeInt16(const int16_t value, const char *const str) { - DEBUGLOG2("writeInt16: " + toStringPrint(static_cast(value)), str); expand(2); #if SDL_BYTEORDER == SDL_BIG_ENDIAN int16_t swap = SDL_Swap16(value); @@ -65,13 +64,15 @@ void MessageOut::writeInt16(const int16_t value, const char *const str) #else memcpy(mData + static_cast(mPos), &value, sizeof(int16_t)); #endif + DEBUGLOG2("writeInt16: " + toStringPrint(static_cast(value)), + mPos, str); mPos += 2; PacketCounters::incOutBytes(2); } void MessageOut::writeInt32(const int32_t value, const char *const str) { - DEBUGLOG2("writeInt32: " + toStringPrint(value), str); + DEBUGLOG2("writeInt32: " + toStringPrint(value), mPos, str); expand(4); #if SDL_BYTEORDER == SDL_BIG_ENDIAN int32_t swap = SDL_Swap32(value); @@ -95,7 +96,7 @@ void MessageOut::writeCoordinates(const uint16_t x, DEBUGLOG2(strprintf("writeCoordinates: %u,%u %u", static_cast(x), static_cast(y), - static_cast(direction)), str); + static_cast(direction)), mPos, str); unsigned char *const data = reinterpret_cast(mData) + static_cast(mPos); mNetwork->mOutSize += 3; -- cgit v1.2.3-70-g09d2