summaryrefslogtreecommitdiff
path: root/src/net/tmwa/traderecv.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/tmwa/traderecv.cpp')
-rw-r--r--src/net/tmwa/traderecv.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/net/tmwa/traderecv.cpp b/src/net/tmwa/traderecv.cpp
index 101666820..876a4549d 100644
--- a/src/net/tmwa/traderecv.cpp
+++ b/src/net/tmwa/traderecv.cpp
@@ -1,11 +1,11 @@
/*
- * The ManaPlus Client
+ * The ManaVerse Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
* Copyright (C) 2011-2020 The ManaPlus Developers
- * Copyright (C) 2020-2023 The ManaVerse Developers
+ * Copyright (C) 2020-2025 The ManaVerse Developers
*
- * This file is part of The ManaPlus Client.
+ * This file is part of The ManaVerse Client.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -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:
@@ -157,6 +158,8 @@ void TradeRecv::processTradeItemAddResponse(Net::MessageIn &msg)
void TradeRecv::processTradeResponse(Net::MessageIn &msg)
{
+ const uint8_t type = msg.readUInt8("type");
+
if (tradePartnerName.empty() ||
!playerRelations.hasPermission(tradePartnerName,
PlayerRelation::TRADE))
@@ -164,7 +167,6 @@ void TradeRecv::processTradeResponse(Net::MessageIn &msg)
tradeHandler->respond(false);
return;
}
- const uint8_t type = msg.readUInt8("type");
Ea::TradeRecv::processTradeResponseContinue(type);
}