diff options
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/manaserv/tradehandler.cpp | 8 | ||||
-rw-r--r-- | src/net/manaserv/tradehandler.h | 1 | ||||
-rw-r--r-- | src/net/tmwa/tradehandler.cpp | 12 | ||||
-rw-r--r-- | src/net/tmwa/tradehandler.h | 3 |
4 files changed, 14 insertions, 10 deletions
diff --git a/src/net/manaserv/tradehandler.cpp b/src/net/manaserv/tradehandler.cpp index 76870c84..b5d526ae 100644 --- a/src/net/manaserv/tradehandler.cpp +++ b/src/net/manaserv/tradehandler.cpp @@ -109,7 +109,7 @@ void TradeHandler::handleMessage(Net::MessageIn &msg) respond(false); break; } - PlayerInfo::setTrading(true); + mTrading = true; tradePartnerName = being->getName(); tradePartnerID = being->getId(); ConfirmDialog *dlg = new ConfirmDialog(_("Request for Trade"), @@ -148,14 +148,14 @@ void TradeHandler::handleMessage(Net::MessageIn &msg) SERVER_NOTICE(_("Trade canceled.")) tradeWindow->setVisible(false); tradeWindow->reset(); - PlayerInfo::setTrading(false); + mTrading = false; break; case GPMSG_TRADE_COMPLETE: SERVER_NOTICE(_("Trade completed.")) tradeWindow->setVisible(false); tradeWindow->reset(); - PlayerInfo::setTrading(false); + mTrading = false; break; } } @@ -176,7 +176,7 @@ void TradeHandler::respond(bool accept) gameServerConnection->send(msg); if (!accept) - PlayerInfo::setTrading(false); + mTrading = false; } void TradeHandler::addItem(Item *item, int amount) diff --git a/src/net/manaserv/tradehandler.h b/src/net/manaserv/tradehandler.h index 4448592c..321b942f 100644 --- a/src/net/manaserv/tradehandler.h +++ b/src/net/manaserv/tradehandler.h @@ -68,6 +68,7 @@ class TradeHandler : public MessageHandler, public Net::TradeHandler private: bool mAcceptTradeRequests; + bool mTrading; }; } // namespace ManaServ diff --git a/src/net/tmwa/tradehandler.cpp b/src/net/tmwa/tradehandler.cpp index e8fb2145..66772468 100644 --- a/src/net/tmwa/tradehandler.cpp +++ b/src/net/tmwa/tradehandler.cpp @@ -98,14 +98,14 @@ void TradeHandler::handleMessage(Net::MessageIn &msg) if (player_relations.hasPermission(tradePartnerName, PlayerRelation::TRADE)) { - if (PlayerInfo::isTrading() || confirmDlg) + if (mTrading || confirmDlg) { Net::getTradeHandler()->respond(false); break; } tradePartnerName = tradePartnerNameTemp; - PlayerInfo::setTrading(true); + mTrading = true; confirmDlg = new ConfirmDialog(_("Request for Trade"), strprintf(_("%s wants to trade with you, do you " "accept?"), tradePartnerName.c_str())); @@ -148,7 +148,7 @@ void TradeHandler::handleMessage(Net::MessageIn &msg) // otherwise ignore silently tradeWindow->setVisible(false); - PlayerInfo::setTrading(false); + mTrading = false; break; default: // Shouldn't happen as well, but to be sure SERVER_NOTICE(_("Unhandled trade cancel packet.")) @@ -224,14 +224,14 @@ void TradeHandler::handleMessage(Net::MessageIn &msg) SERVER_NOTICE(_("Trade canceled.")) tradeWindow->setVisible(false); tradeWindow->reset(); - PlayerInfo::setTrading(false); + mTrading = false; break; case SMSG_TRADE_COMPLETE: SERVER_NOTICE(_("Trade completed.")) tradeWindow->setVisible(false); tradeWindow->reset(); - PlayerInfo::setTrading(false); + mTrading = false; break; } } @@ -245,7 +245,7 @@ void TradeHandler::request(Being *being) void TradeHandler::respond(bool accept) { if (!accept) - PlayerInfo::setTrading(false); + mTrading = false; MessageOut outMsg(CMSG_TRADE_RESPONSE); outMsg.writeInt8(accept ? 3 : 4); diff --git a/src/net/tmwa/tradehandler.h b/src/net/tmwa/tradehandler.h index 801c03b7..443d763a 100644 --- a/src/net/tmwa/tradehandler.h +++ b/src/net/tmwa/tradehandler.h @@ -51,6 +51,9 @@ class TradeHandler : public MessageHandler, public Net::TradeHandler void finish(); void cancel(); + + private: + bool mTrading; }; } // namespace TmwAthena |