From c8002e43c3fd32152ae5b26e6568d35c2861b6fd Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 2 Sep 2014 18:09:38 +0300 Subject: add packet comments in gamehandler. --- src/net/ea/gamehandler.cpp | 7 ++++--- src/net/eathena/gamehandler.cpp | 6 +++--- src/net/tmwa/gamehandler.cpp | 18 +++++++++--------- 3 files changed, 16 insertions(+), 15 deletions(-) (limited to 'src/net') diff --git a/src/net/ea/gamehandler.cpp b/src/net/ea/gamehandler.cpp index cce62c1af..e8e114c30 100644 --- a/src/net/ea/gamehandler.cpp +++ b/src/net/ea/gamehandler.cpp @@ -60,18 +60,19 @@ void GameHandler::setMap(const std::string &map) void GameHandler::processWhoAnswer(Net::MessageIn &msg) const { - NotifyManager::notify(NotifyTypes::ONLINE_USERS, msg.readInt32()); + NotifyManager::notify(NotifyTypes::ONLINE_USERS, + msg.readInt32("users count")); } void GameHandler::processCharSwitchResponse(Net::MessageIn &msg) const { - if (msg.readUInt8()) + if (msg.readUInt8("response")) client->setState(STATE_SWITCH_CHARACTER); } void GameHandler::processMapQuitResponse(Net::MessageIn &msg) const { - if (msg.readUInt8()) + if (msg.readUInt8("response")) { new OkDialog(_("Game"), // TRANSLATORS: error message diff --git a/src/net/eathena/gamehandler.cpp b/src/net/eathena/gamehandler.cpp index d56977371..1cb6ef40b 100644 --- a/src/net/eathena/gamehandler.cpp +++ b/src/net/eathena/gamehandler.cpp @@ -108,7 +108,7 @@ void GameHandler::connect() mNetwork->connect(mapServer); const Token &token = - static_cast(Net::getLoginHandler())->getToken(); + static_cast(Net::getLoginHandler())->getToken(); if (client->getState() == STATE_CONNECT_GAME) @@ -164,7 +164,7 @@ void GameHandler::quit() const void GameHandler::ping(const int tick) const { MessageOut msg(CMSG_CLIENT_PING); - msg.writeInt32(tick); + msg.writeInt32(tick, "tick"); } void GameHandler::disconnect2() const @@ -182,7 +182,7 @@ void GameHandler::processMapLogin(Net::MessageIn &msg) const unsigned char direction; uint16_t x, y; msg.readInt32("start time"); - msg.readCoordinates(x, y, direction); + msg.readCoordinates(x, y, direction, "position"); msg.readInt8("x size"); msg.readInt8("y size"); logger->log("Protocol: Player start position: " diff --git a/src/net/tmwa/gamehandler.cpp b/src/net/tmwa/gamehandler.cpp index ae60a0874..f0c3c0d5d 100644 --- a/src/net/tmwa/gamehandler.cpp +++ b/src/net/tmwa/gamehandler.cpp @@ -122,11 +122,11 @@ void GameHandler::connect() // Send login infos MessageOut outMsg(CMSG_MAP_SERVER_CONNECT); - outMsg.writeInt32(token.account_ID); - outMsg.writeInt32(mCharID); - outMsg.writeInt32(token.session_ID1); - outMsg.writeInt32(token.session_ID2); - outMsg.writeInt8(Being::genderToInt(token.sex)); + outMsg.writeInt32(token.account_ID, "account id"); + outMsg.writeInt32(mCharID, "char id"); + outMsg.writeInt32(token.session_ID1, "session id1"); + outMsg.writeInt32(token.session_ID2, "session id2"); + outMsg.writeInt8(Being::genderToInt(token.sex), "gender"); /* if (localPlayer) @@ -163,7 +163,7 @@ void GameHandler::quit() const void GameHandler::ping(const int tick) const { MessageOut msg(CMSG_CLIENT_PING); - msg.writeInt32(tick); + msg.writeInt32(tick, "tick"); } void GameHandler::disconnect2() const @@ -175,9 +175,9 @@ void GameHandler::processMapLogin(Net::MessageIn &msg) const { unsigned char direction; uint16_t x, y; - msg.readInt32(); // server tick - msg.readCoordinates(x, y, direction); - msg.skip(2); // 0x0505 + msg.readInt32("tick"); + msg.readCoordinates(x, y, direction, "position"); + msg.skip(2, "unknown?"); logger->log("Protocol: Player start position: (%d, %d)," " Direction: %d", x, y, direction); -- cgit v1.2.3-70-g09d2