summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-10-23 20:23:04 +0300
committerAndrei Karas <akaras@inbox.ru>2014-10-23 20:23:04 +0300
commit4d02075c3daaefca2dcad72546e1e45b4219b5ad (patch)
tree9df679951e8c25efa1a0288a9b8105e8992f3c76
parentb2683954e4574905ce3cc0cbf9afeeee35549009 (diff)
downloadmanaverse-4d02075c3daaefca2dcad72546e1e45b4219b5ad.tar.gz
manaverse-4d02075c3daaefca2dcad72546e1e45b4219b5ad.tar.bz2
manaverse-4d02075c3daaefca2dcad72546e1e45b4219b5ad.tar.xz
manaverse-4d02075c3daaefca2dcad72546e1e45b4219b5ad.zip
Add packet fields comments in tradehandler.
-rw-r--r--src/net/ea/tradehandler.cpp4
-rw-r--r--src/net/eathena/tradehandler.cpp13
-rw-r--r--src/net/tmwa/tradehandler.cpp28
3 files changed, 23 insertions, 22 deletions
diff --git a/src/net/ea/tradehandler.cpp b/src/net/ea/tradehandler.cpp
index 1b0067f7c..2a478d953 100644
--- a/src/net/ea/tradehandler.cpp
+++ b/src/net/ea/tradehandler.cpp
@@ -136,9 +136,9 @@ void TradeHandler::processTradeOk(Net::MessageIn &msg)
{
// 0 means ok from myself, 1 means ok from other;
if (tradeWindow)
- tradeWindow->receivedOk(msg.readUInt8() == 0U);
+ tradeWindow->receivedOk(msg.readUInt8("status") == 0U);
else
- msg.readUInt8();
+ msg.readUInt8("status");
}
void TradeHandler::processTradeCancel(Net::MessageIn &msg A_UNUSED)
diff --git a/src/net/eathena/tradehandler.cpp b/src/net/eathena/tradehandler.cpp
index 15eb5c4bf..3d76d9e78 100644
--- a/src/net/eathena/tradehandler.cpp
+++ b/src/net/eathena/tradehandler.cpp
@@ -123,7 +123,7 @@ void TradeHandler::request(const Being *const being) const
return;
createOutPacket(CMSG_TRADE_REQUEST);
- outMsg.writeInt32(being->getId());
+ outMsg.writeInt32(being->getId(), "player id");
}
void TradeHandler::respond(const bool accept) const
@@ -132,7 +132,7 @@ void TradeHandler::respond(const bool accept) const
PlayerInfo::setTrading(false);
createOutPacket(CMSG_TRADE_RESPONSE);
- outMsg.writeInt8(static_cast<int8_t>(accept ? 3 : 4));
+ outMsg.writeInt8(static_cast<int8_t>(accept ? 3 : 4), "accept");
}
void TradeHandler::addItem(const Item *const item, const int amount) const
@@ -143,15 +143,16 @@ void TradeHandler::addItem(const Item *const item, const int amount) const
mItemIndex = item->getInvIndex();
mQuantity = amount;
createOutPacket(CMSG_TRADE_ITEM_ADD_REQUEST);
- outMsg.writeInt16(static_cast<int16_t>(mItemIndex + INVENTORY_OFFSET));
- outMsg.writeInt32(amount);
+ outMsg.writeInt16(static_cast<int16_t>(mItemIndex + INVENTORY_OFFSET),
+ "index");
+ outMsg.writeInt32(amount, "amount");
}
void TradeHandler::setMoney(const int amount) const
{
createOutPacket(CMSG_TRADE_ITEM_ADD_REQUEST);
- outMsg.writeInt16(0);
- outMsg.writeInt32(amount);
+ outMsg.writeInt16(0, "index");
+ outMsg.writeInt32(amount, "amount");
}
void TradeHandler::confirm() const
diff --git a/src/net/tmwa/tradehandler.cpp b/src/net/tmwa/tradehandler.cpp
index 5cb9e4ae2..141f2d8ce 100644
--- a/src/net/tmwa/tradehandler.cpp
+++ b/src/net/tmwa/tradehandler.cpp
@@ -113,7 +113,7 @@ void TradeHandler::request(const Being *const being) const
return;
createOutPacket(CMSG_TRADE_REQUEST);
- outMsg.writeInt32(being->getId());
+ outMsg.writeInt32(being->getId(), "player id");
}
void TradeHandler::respond(const bool accept) const
@@ -122,7 +122,7 @@ void TradeHandler::respond(const bool accept) const
PlayerInfo::setTrading(false);
createOutPacket(CMSG_TRADE_RESPONSE);
- outMsg.writeInt8(static_cast<int8_t>(accept ? 3 : 4));
+ outMsg.writeInt8(static_cast<int8_t>(accept ? 3 : 4), "accept");
}
void TradeHandler::addItem(const Item *const item, const int amount) const
@@ -132,15 +132,15 @@ void TradeHandler::addItem(const Item *const item, const int amount) const
createOutPacket(CMSG_TRADE_ITEM_ADD_REQUEST);
outMsg.writeInt16(static_cast<int16_t>(
- item->getInvIndex() + INVENTORY_OFFSET));
- outMsg.writeInt32(amount);
+ item->getInvIndex() + INVENTORY_OFFSET), "index");
+ outMsg.writeInt32(amount, "amount");
}
void TradeHandler::setMoney(const int amount) const
{
createOutPacket(CMSG_TRADE_ITEM_ADD_REQUEST);
- outMsg.writeInt16(0);
- outMsg.writeInt32(amount);
+ outMsg.writeInt16(0, "index");
+ outMsg.writeInt32(amount, "amount");
}
void TradeHandler::confirm() const
@@ -165,11 +165,11 @@ void TradeHandler::processTradeRequest(Net::MessageIn &msg)
void TradeHandler::processTradeItemAdd(Net::MessageIn &msg)
{
- const int amount = msg.readInt32();
- const int type = msg.readInt16();
- const uint8_t identify = msg.readUInt8(); // identified flag
- msg.readUInt8(); // attribute
- const uint8_t refine = msg.readUInt8(); // refine
+ const int amount = msg.readInt32("amount");
+ const int type = msg.readInt16("type");
+ const uint8_t identify = msg.readUInt8("identify");
+ msg.readUInt8("attribute");
+ const uint8_t refine = msg.readUInt8("refine");
int cards[4];
for (int f = 0; f < 4; f++)
cards[f] = msg.readInt16("card");
@@ -203,7 +203,7 @@ void TradeHandler::processTradeItemAdd(Net::MessageIn &msg)
void TradeHandler::processTradeItemAddResponse(Net::MessageIn &msg)
{
// Trade: New Item add response (was 0x00ea, now 01b1)
- const int index = msg.readInt16() - INVENTORY_OFFSET;
+ const int index = msg.readInt16("index") - INVENTORY_OFFSET;
Item *item = nullptr;
if (PlayerInfo::getInventory())
item = PlayerInfo::getInventory()->getItem(index);
@@ -214,9 +214,9 @@ void TradeHandler::processTradeItemAddResponse(Net::MessageIn &msg)
tradeWindow->receivedOk(true);
return;
}
- const int quantity = msg.readInt16();
+ const int quantity = msg.readInt16("amount");
- const uint8_t res = msg.readUInt8();
+ const uint8_t res = msg.readUInt8("status");
switch (res)
{
case 0: