summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-10-23 16:45:25 +0300
committerAndrei Karas <akaras@inbox.ru>2014-10-23 19:46:20 +0300
commit4957ee9dc5c0389ec1d45bf4553683e34a2e204e (patch)
tree3ddd9874a4b2c27b5fa462a256b4bf35d5c9498f
parenta29fd5e8a4bca6b6a11c44bff33c79a5f7b44bd3 (diff)
downloadmanaplus-4957ee9dc5c0389ec1d45bf4553683e34a2e204e.tar.gz
manaplus-4957ee9dc5c0389ec1d45bf4553683e34a2e204e.tar.bz2
manaplus-4957ee9dc5c0389ec1d45bf4553683e34a2e204e.tar.xz
manaplus-4957ee9dc5c0389ec1d45bf4553683e34a2e204e.zip
Add packet fields comments in partyhandler.
-rw-r--r--src/net/ea/partyhandler.cpp48
-rw-r--r--src/net/eathena/partyhandler.cpp28
-rw-r--r--src/net/tmwa/partyhandler.cpp56
3 files changed, 66 insertions, 66 deletions
diff --git a/src/net/ea/partyhandler.cpp b/src/net/ea/partyhandler.cpp
index a04e4861c..806864324 100644
--- a/src/net/ea/partyhandler.cpp
+++ b/src/net/ea/partyhandler.cpp
@@ -159,32 +159,32 @@ void PartyHandler::processPartySettingsContinue(const int16_t exp,
void PartyHandler::processPartyMove(Net::MessageIn &msg)
{
- const int id = msg.readInt32(); // id
+ const int id = msg.readInt32("id");
PartyMember *m = nullptr;
if (Ea::taParty)
m = Ea::taParty->getMember(id);
if (m)
{
- msg.skip(4); // 0
- m->setX(msg.readInt16()); // x
- m->setY(msg.readInt16()); // y
- const bool online = msg.readUInt8() != 0;
+ msg.readInt32("unused");
+ m->setX(msg.readInt16("x"));
+ m->setY(msg.readInt16("y"));
+ const bool online = msg.readUInt8("online") != 0;
if (m->getOnline() != online)
partyTab->showOnline(m->getName(), online);
- m->setOnline(online); // online (if 0)
- msg.readString(24); // party
- msg.readString(24); // nick
- m->setMap(msg.readString(16)); // map
+ m->setOnline(online);
+ msg.readString(24, "party");
+ msg.readString(24, "nick");
+ m->setMap(msg.readString(16, "map"));
}
else
{
- msg.skip(4); // 0
- msg.readInt16(); // x
- msg.readInt16(); // y
- msg.readUInt8(); // online (if 0)
- msg.readString(24); // party
- msg.readString(24); // nick
- msg.readString(16); // map
+ msg.readInt32("unused");
+ msg.readInt16("x");
+ msg.readInt16("y");
+ msg.readUInt8("online");
+ msg.readString(24, "party");
+ msg.readString(24, "nick");
+ msg.readString(16, "map");
}
}
@@ -274,9 +274,9 @@ void PartyHandler::processPartyLeave(Net::MessageIn &msg)
void PartyHandler::processPartyUpdateHp(Net::MessageIn &msg)
{
- const int id = msg.readInt32();
- const int hp = msg.readInt16();
- const int maxhp = msg.readInt16();
+ const int id = msg.readInt32("id");
+ const int hp = msg.readInt16("hp");
+ const int maxhp = msg.readInt16("max hp");
PartyMember *m = nullptr;
if (Ea::taParty)
m = Ea::taParty->getMember(id);
@@ -297,19 +297,19 @@ void PartyHandler::processPartyUpdateHp(Net::MessageIn &msg)
void PartyHandler::processPartyUpdateCoords(Net::MessageIn &msg)
{
- const int id = msg.readInt32(); // id
+ const int id = msg.readInt32("id");
PartyMember *m = nullptr;
if (Ea::taParty)
m = Ea::taParty->getMember(id);
if (m)
{
- m->setX(msg.readInt16()); // x
- m->setY(msg.readInt16()); // y
+ m->setX(msg.readInt16("x"));
+ m->setY(msg.readInt16("y"));
}
else
{
- msg.readInt16(); // x
- msg.readInt16(); // y
+ msg.readInt16("x");
+ msg.readInt16("y");
}
}
diff --git a/src/net/eathena/partyhandler.cpp b/src/net/eathena/partyhandler.cpp
index 9a83a739e..1751140a5 100644
--- a/src/net/eathena/partyhandler.cpp
+++ b/src/net/eathena/partyhandler.cpp
@@ -129,7 +129,7 @@ void PartyHandler::handleMessage(Net::MessageIn &msg)
void PartyHandler::create(const std::string &name) const
{
createOutPacket(CMSG_PARTY_CREATE);
- outMsg.writeString(name.substr(0, 23), 24);
+ outMsg.writeString(name.substr(0, 23), 24, "party name");
}
void PartyHandler::invite(const std::string &name) const
@@ -157,8 +157,8 @@ void PartyHandler::inviteResponse(const std::string &inviter A_UNUSED,
if (localPlayer)
{
createOutPacket(CMSG_PARTY_INVITED2);
- outMsg.writeInt32(localPlayer->getId());
- outMsg.writeInt8(static_cast<int8_t>(accept ? 1 : 0));
+ outMsg.writeInt32(localPlayer->getId(), "account id");
+ outMsg.writeInt8(static_cast<int8_t>(accept ? 1 : 0), "accept");
}
}
@@ -172,8 +172,8 @@ void PartyHandler::kick(const Being *const being) const
if (being)
{
createOutPacket(CMSG_PARTY_KICK);
- outMsg.writeInt32(being->getId());
- outMsg.writeString("", 24); // unused
+ outMsg.writeInt32(being->getId(), "account id");
+ outMsg.writeString(being->getName(), 24, "player name");
}
}
@@ -190,8 +190,8 @@ void PartyHandler::kick(const std::string &name) const
}
createOutPacket(CMSG_PARTY_KICK);
- outMsg.writeInt32(m->getID());
- outMsg.writeString(name, 24); // unused
+ outMsg.writeInt32(m->getID(), "account id");
+ outMsg.writeString(name, 24, "player name");
}
void PartyHandler::chat(const std::string &text) const
@@ -212,8 +212,8 @@ void PartyHandler::setShareExperience(const Net::PartyShare::Type share) const
return;
createOutPacket(CMSG_PARTY_SETTINGS);
- outMsg.writeInt16(static_cast<int16_t>(share));
- outMsg.writeInt16(static_cast<int16_t>(mShareItems));
+ outMsg.writeInt16(static_cast<int16_t>(share), "share exp");
+ outMsg.writeInt16(static_cast<int16_t>(mShareItems), "share items");
}
// +++ must be 3 types item, exp, pickup
@@ -223,8 +223,8 @@ void PartyHandler::setShareItems(const Net::PartyShare::Type share) const
return;
createOutPacket(CMSG_PARTY_SETTINGS);
- outMsg.writeInt16(static_cast<int16_t>(mShareExp));
- outMsg.writeInt16(static_cast<int16_t>(share));
+ outMsg.writeInt16(static_cast<int16_t>(mShareExp), "share exp");
+ outMsg.writeInt16(static_cast<int16_t>(share), "share items");
}
void PartyHandler::processPartyInvitationStats(Net::MessageIn &msg)
@@ -386,7 +386,7 @@ void PartyHandler::processPartyInfo(Net::MessageIn &msg)
void PartyHandler::processPartyMessage(Net::MessageIn &msg)
{
- const int msgLength = msg.readInt16() - 8;
+ const int msgLength = msg.readInt16("len") - 8;
if (msgLength <= 0)
return;
@@ -461,13 +461,13 @@ void PartyHandler::changeLeader(const std::string &name) const
if (!being)
return;
createOutPacket(CMSG_PARTY_CHANGE_LEADER);
- outMsg.writeInt32(being->getId());
+ outMsg.writeInt32(being->getId(), "account id");
}
void PartyHandler::allowInvite(const bool allow) const
{
createOutPacket(CMSG_PARTY_ALLOW_INVITES);
- outMsg.writeInt8(static_cast<int8_t>(allow ? 1 : 0));
+ outMsg.writeInt8(static_cast<int8_t>(allow ? 1 : 0), "allow");
}
void PartyHandler::processPartyItemPickup(Net::MessageIn &msg)
diff --git a/src/net/tmwa/partyhandler.cpp b/src/net/tmwa/partyhandler.cpp
index 72e3fcbce..7cf5cef3e 100644
--- a/src/net/tmwa/partyhandler.cpp
+++ b/src/net/tmwa/partyhandler.cpp
@@ -115,7 +115,7 @@ void PartyHandler::handleMessage(Net::MessageIn &msg)
void PartyHandler::create(const std::string &name) const
{
createOutPacket(CMSG_PARTY_CREATE);
- outMsg.writeString(name.substr(0, 23), 24);
+ outMsg.writeString(name.substr(0, 23), 24, "party name");
}
void PartyHandler::invite(const std::string &name) const
@@ -128,7 +128,7 @@ void PartyHandler::invite(const std::string &name) const
if (being)
{
createOutPacket(CMSG_PARTY_INVITE);
- outMsg.writeInt32(being->getId());
+ outMsg.writeInt32(being->getId(), "account id");
}
}
@@ -138,8 +138,8 @@ void PartyHandler::inviteResponse(const std::string &inviter A_UNUSED,
if (localPlayer)
{
createOutPacket(CMSG_PARTY_INVITED);
- outMsg.writeInt32(localPlayer->getId());
- outMsg.writeInt32(accept ? 1 : 0);
+ outMsg.writeInt32(localPlayer->getId(), "account id");
+ outMsg.writeInt32(accept ? 1 : 0, "accept");
}
}
@@ -153,8 +153,8 @@ void PartyHandler::kick(const Being *const being) const
if (being)
{
createOutPacket(CMSG_PARTY_KICK);
- outMsg.writeInt32(being->getId());
- outMsg.writeString("", 24); // unused
+ outMsg.writeInt32(being->getId(), "account id");
+ outMsg.writeString("", 24, "unused");
}
}
@@ -171,15 +171,15 @@ void PartyHandler::kick(const std::string &name) const
}
createOutPacket(CMSG_PARTY_KICK);
- outMsg.writeInt32(m->getID());
- outMsg.writeString(name, 24); // unused
+ outMsg.writeInt32(m->getID(), "member id");
+ outMsg.writeString(name, 24, "unused");
}
void PartyHandler::chat(const std::string &text) const
{
createOutPacket(CMSG_PARTY_MESSAGE);
- outMsg.writeInt16(static_cast<int16_t>(text.length() + 4));
- outMsg.writeString(text, static_cast<int>(text.length()));
+ outMsg.writeInt16(static_cast<int16_t>(text.length() + 4), "len");
+ outMsg.writeString(text, static_cast<int>(text.length()), "text");
}
void PartyHandler::setShareExperience(const Net::PartyShare::Type share) const
@@ -188,8 +188,8 @@ void PartyHandler::setShareExperience(const Net::PartyShare::Type share) const
return;
createOutPacket(CMSG_PARTY_SETTINGS);
- outMsg.writeInt16(static_cast<int16_t>(share));
- outMsg.writeInt16(static_cast<int16_t>(mShareItems));
+ outMsg.writeInt16(static_cast<int16_t>(share), "share exp");
+ outMsg.writeInt16(static_cast<int16_t>(mShareItems), "share items");
}
void PartyHandler::setShareItems(const Net::PartyShare::Type share) const
@@ -198,8 +198,8 @@ void PartyHandler::setShareItems(const Net::PartyShare::Type share) const
return;
createOutPacket(CMSG_PARTY_SETTINGS);
- outMsg.writeInt16(static_cast<int16_t>(mShareExp));
- outMsg.writeInt16(static_cast<int16_t>(share));
+ outMsg.writeInt16(static_cast<int16_t>(mShareExp), "share exp");
+ outMsg.writeInt16(static_cast<int16_t>(share), "share items");
}
void PartyHandler::processPartySettings(Net::MessageIn &msg)
@@ -213,8 +213,8 @@ void PartyHandler::processPartySettings(Net::MessageIn &msg)
}
// These seem to indicate the sharing mode for exp and items
- const int16_t exp = msg.readInt16();
- const int16_t item = msg.readInt16();
+ const int16_t exp = msg.readInt16("share exp");
+ const int16_t item = msg.readInt16("share items");
processPartySettingsContinue(exp, item);
}
@@ -251,9 +251,9 @@ void PartyHandler::processPartyInfo(Net::MessageIn &msg)
if (Ea::taParty)
Ea::taParty->clearMembers();
- const int length = msg.readInt16();
+ const int length = msg.readInt16("len");
if (Ea::taParty)
- Ea::taParty->setName(msg.readString(24));
+ Ea::taParty->setName(msg.readString(24, "party name"));
const int count = (length - 28) / 46;
if (localPlayer && Ea::taParty)
@@ -264,11 +264,11 @@ void PartyHandler::processPartyInfo(Net::MessageIn &msg)
for (int i = 0; i < count; i++)
{
- const int id = msg.readInt32();
- std::string nick = msg.readString(24);
- std::string map = msg.readString(16);
- const bool leader = msg.readUInt8() == 0U;
- const bool online = msg.readUInt8() == 0U;
+ const int id = msg.readInt32("id");
+ std::string nick = msg.readString(24, "nick");
+ std::string map = msg.readString(16, "map");
+ const bool leader = msg.readUInt8("leader") == 0U;
+ const bool online = msg.readUInt8("online") == 0U;
if (Ea::taParty)
{
@@ -324,12 +324,12 @@ void PartyHandler::processPartyInfo(Net::MessageIn &msg)
void PartyHandler::processPartyMessage(Net::MessageIn &msg)
{
- const int msgLength = msg.readInt16() - 8;
+ const int msgLength = msg.readInt16("len") - 8;
if (msgLength <= 0)
return;
- const int id = msg.readInt32();
- const std::string chatMsg = msg.readString(msgLength);
+ const int id = msg.readInt32("id");
+ const std::string chatMsg = msg.readString(msgLength, "message");
if (Ea::taParty && partyTab)
{
@@ -351,9 +351,9 @@ void PartyHandler::processPartyInviteResponse(Net::MessageIn &msg)
if (!partyTab)
return;
- const std::string nick = msg.readString(24);
+ const std::string nick = msg.readString(24, "nick");
- switch (msg.readUInt8())
+ switch (msg.readUInt8("status"))
{
case 0:
NotifyManager::notify(NotifyTypes::PARTY_INVITE_ALREADY_MEMBER,