diff options
author | Fedja Beader <fedja@protonmail.ch> | 2025-03-30 21:22:25 +0000 |
---|---|---|
committer | Fedja Beader <fedja@protonmail.ch> | 2025-04-01 01:53:36 +0200 |
commit | c7a01a480e111b88efe53e8abb9bcca801332f4d (patch) | |
tree | 66f1f5cb3d4649edb870e99a7df566459b637d52 | |
parent | c7b42c757f9a482f308614a6a6c9811c7ae55a54 (diff) | |
download | manaplus-c7a01a480e111b88efe53e8abb9bcca801332f4d.tar.gz manaplus-c7a01a480e111b88efe53e8abb9bcca801332f4d.tar.bz2 manaplus-c7a01a480e111b88efe53e8abb9bcca801332f4d.tar.xz manaplus-c7a01a480e111b88efe53e8abb9bcca801332f4d.zip |
processTradeItemAddResponse: fix early exit before full packet is consumed.
2025-03/22/#Debug.log-[19:38:37] Wrong actual or planned inbound packet size!. Packet id: 433(0x1b1), Planned size: 7, Actual size: 4
2025-03/22/#Debug.log:[19:38:52] You picked up 1 [@@760|Overlord's Helmet@@].
****
mana/plus!146
-rw-r--r-- | src/net/tmwa/traderecv.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/net/tmwa/traderecv.cpp b/src/net/tmwa/traderecv.cpp index 101666820..1f4079e7c 100644 --- a/src/net/tmwa/traderecv.cpp +++ b/src/net/tmwa/traderecv.cpp @@ -98,6 +98,9 @@ void TradeRecv::processTradeItemAddResponse(Net::MessageIn &msg) { // Trade: New Item add response (was 0x00ea, now 01b1) const int index = msg.readInt16("index") - INVENTORY_OFFSET; + const int quantity = msg.readInt16("amount"); + const uint8_t res = msg.readUInt8("status"); + Item *item = nullptr; if (PlayerInfo::getInventory() != nullptr) item = PlayerInfo::getInventory()->getItem(index); @@ -108,9 +111,7 @@ void TradeRecv::processTradeItemAddResponse(Net::MessageIn &msg) tradeWindow->receivedOk(true); return; } - const int quantity = msg.readInt16("amount"); - const uint8_t res = msg.readUInt8("status"); switch (res) { case 0: |