summaryrefslogtreecommitdiff
path: root/src/net/eathena
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-08-31 14:11:23 +0300
committerAndrei Karas <akaras@inbox.ru>2014-08-31 14:11:23 +0300
commit544de86739a85792be7e6883968b2af8590d0711 (patch)
treeecdbe7aa2224e2aca5f3124443c417457bc94775 /src/net/eathena
parenta63248380554067d4291c653b4ba82db36fbc821 (diff)
downloadmv-544de86739a85792be7e6883968b2af8590d0711.tar.gz
mv-544de86739a85792be7e6883968b2af8590d0711.tar.bz2
mv-544de86739a85792be7e6883968b2af8590d0711.tar.xz
mv-544de86739a85792be7e6883968b2af8590d0711.zip
Add comments for outbound packet fields in debug log.
Diffstat (limited to 'src/net/eathena')
-rw-r--r--src/net/eathena/messageout.cpp17
-rw-r--r--src/net/eathena/messageout.h11
2 files changed, 17 insertions, 11 deletions
diff --git a/src/net/eathena/messageout.cpp b/src/net/eathena/messageout.cpp
index 386f5b046..7c5d328cb 100644
--- a/src/net/eathena/messageout.cpp
+++ b/src/net/eathena/messageout.cpp
@@ -46,7 +46,7 @@ MessageOut::MessageOut(const int16_t id) :
mData = mNetwork->mOutBuffer + static_cast<size_t>(mNetwork->mOutSize);
// +++ can be issue. call to virtual member
- writeInt16(id);
+ writeInt16(id, "packet id");
}
void MessageOut::expand(const size_t bytes)
@@ -55,9 +55,9 @@ void MessageOut::expand(const size_t bytes)
PacketCounters::incOutBytes(static_cast<int>(bytes));
}
-void MessageOut::writeInt16(const int16_t value)
+void MessageOut::writeInt16(const int16_t value, const char *const str)
{
- DEBUGLOG("writeInt16: " + toStringPrint(static_cast<int>(value)));
+ DEBUGLOG2("writeInt16: " + toStringPrint(static_cast<int>(value)), str);
expand(2);
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
int16_t swap = SDL_Swap16(value);
@@ -69,9 +69,9 @@ void MessageOut::writeInt16(const int16_t value)
PacketCounters::incOutBytes(2);
}
-void MessageOut::writeInt32(const int32_t value)
+void MessageOut::writeInt32(const int32_t value, const char *const str)
{
- DEBUGLOG("writeInt32: " + toStringPrint(value));
+ DEBUGLOG2("writeInt32: " + toStringPrint(value), str);
expand(4);
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
int32_t swap = SDL_Swap32(value);
@@ -89,12 +89,13 @@ static_cast<uint16_t>(w)) >> 8))
void MessageOut::writeCoordinates(const uint16_t x,
const uint16_t y,
- unsigned char direction)
+ unsigned char direction,
+ const char *const str)
{
- DEBUGLOG(strprintf("writeCoordinates: %u,%u %u",
+ DEBUGLOG2(strprintf("writeCoordinates: %u,%u %u",
static_cast<unsigned>(x),
static_cast<unsigned>(y),
- static_cast<unsigned>(direction)));
+ static_cast<unsigned>(direction)), str);
unsigned char *const data = reinterpret_cast<unsigned char*>(mData)
+ static_cast<size_t>(mPos);
mNetwork->mOutSize += 3;
diff --git a/src/net/eathena/messageout.h b/src/net/eathena/messageout.h
index 121d5a88f..8834d44fe 100644
--- a/src/net/eathena/messageout.h
+++ b/src/net/eathena/messageout.h
@@ -47,16 +47,21 @@ class MessageOut final : public Net::MessageOut
A_DELETE_COPY(MessageOut)
- void writeInt16(const int16_t value); /**< Writes a short. */
+ /**< Writes a short. */
+ void writeInt16(const int16_t value,
+ const char *const str = nullptr);
- void writeInt32(const int32_t value); /**< Writes a long. */
+ /**< Writes a long. */
+ void writeInt32(const int32_t value,
+ const char *const str = nullptr);
/**
* Encodes coordinates and direction in 3 bytes.
*/
void writeCoordinates(const uint16_t x,
const uint16_t y,
- unsigned char direction);
+ unsigned char direction,
+ const char *const str = nullptr);
void resetPos()
{ mPos = 0; }