diff options
author | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2012-01-28 17:34:39 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2012-01-28 19:02:27 +0100 |
commit | 4502951aed77f18175adb601f0e094fd921c360d (patch) | |
tree | 111f0efad74dad24932f5685f572e4c4031d7a49 /src/net | |
parent | afdb517a87836995de7a94921cb2bfb2f9a2d56a (diff) | |
download | mana-4502951aed77f18175adb601f0e094fd921c360d.tar.gz mana-4502951aed77f18175adb601f0e094fd921c360d.tar.bz2 mana-4502951aed77f18175adb601f0e094fd921c360d.tar.xz mana-4502951aed77f18175adb601f0e094fd921c360d.zip |
Moved mTrading into the TradeHandler
Really only the trade handler is concerned about whether the player is
currently in a trade or not.
Reviewed-by: Erik Schilling
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 |