diff options
author | Chuck Miller <shadowmil@gmail.com> | 2010-07-18 23:02:25 -0400 |
---|---|---|
committer | Chuck Miller <shadowmil@gmail.com> | 2010-07-18 23:10:02 -0400 |
commit | 41a23cb4511e9ba3985990e2703fb3d680a23d14 (patch) | |
tree | 2bf03217e3c3b0f28aed5649e2e43cf2b965bd1d /src/net/tmwa/tradehandler.cpp | |
parent | 782158dfd719fb6d196f79075f275fb8599d393c (diff) | |
download | mana-41a23cb4511e9ba3985990e2703fb3d680a23d14.tar.gz mana-41a23cb4511e9ba3985990e2703fb3d680a23d14.tar.bz2 mana-41a23cb4511e9ba3985990e2703fb3d680a23d14.tar.xz mana-41a23cb4511e9ba3985990e2703fb3d680a23d14.zip |
Move the majority of the netcode's server messages to the event system
There is still a good way to go, but this should get us
started
Reviewed-by: Jared Adams
Diffstat (limited to 'src/net/tmwa/tradehandler.cpp')
-rw-r--r-- | src/net/tmwa/tradehandler.cpp | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/src/net/tmwa/tradehandler.cpp b/src/net/tmwa/tradehandler.cpp index 2c82f1e2..0610f5be 100644 --- a/src/net/tmwa/tradehandler.cpp +++ b/src/net/tmwa/tradehandler.cpp @@ -21,6 +21,8 @@ #include "net/tmwa/tradehandler.h" +#include "event.h" +#include "eventmanager.h" #include "inventory.h" #include "item.h" #include "localplayer.h" @@ -30,8 +32,6 @@ #include "gui/confirmdialog.h" #include "gui/trade.h" -#include "gui/widgets/chattab.h" - #include "net/inventoryhandler.h" #include "net/messagein.h" #include "net/messageout.h" @@ -122,16 +122,16 @@ void TradeHandler::handleMessage(Net::MessageIn &msg) switch (msg.readInt8()) { case 0: // Too far away - localChatTab->chatLog(_("Trading isn't possible. Trade " - "partner is too far away."), BY_SERVER); + SERVER_NOTICE(_("Trading isn't possible. Trade " + "partner is too far away.")) break; case 1: // Character doesn't exist - localChatTab->chatLog(_("Trading isn't possible. Character " - "doesn't exist."), BY_SERVER); + SERVER_NOTICE(_("Trading isn't possible. Character " + "doesn't exist.")) break; case 2: // Invite request check failed... - localChatTab->chatLog(_("Trade cancelled due to an unknown " - "reason."), BY_SERVER); + SERVER_NOTICE(_("Trade cancelled due to an unknown " + "reason.")) break; case 3: // Trade accepted tradeWindow->reset(); @@ -142,17 +142,15 @@ void TradeHandler::handleMessage(Net::MessageIn &msg) case 4: // Trade cancelled if (player_relations.hasPermission(tradePartnerName, PlayerRelation::SPEECH_LOG)) - localChatTab->chatLog(strprintf(_("Trade with %s " - "cancelled."), tradePartnerName.c_str()), - BY_SERVER); + SERVER_NOTICE(strprintf(_("Trade with %s cancelled."), + tradePartnerName.c_str())) // otherwise ignore silently tradeWindow->setVisible(false); PlayerInfo::setTrading(false); break; default: // Shouldn't happen as well, but to be sure - localChatTab->chatLog(_("Unhandled trade cancel packet."), - BY_SERVER); + SERVER_NOTICE(_("Unhandled trade cancel packet.")) break; } break; @@ -200,17 +198,17 @@ void TradeHandler::handleMessage(Net::MessageIn &msg) break; case 1: // Add item failed - player overweighted - localChatTab->chatLog(_("Failed adding item. Trade " - "partner is over weighted."), BY_SERVER); + SERVER_NOTICE(_("Failed adding item. Trade " + "partner is over weighted.")) break; case 2: // Add item failed - player has no free slot - localChatTab->chatLog(_("Failed adding item. Trade " - "partner has no free slot."), BY_SERVER); + SERVER_NOTICE(_("Failed adding item. Trade " + "partner has no free slot.")) break; default: - localChatTab->chatLog(_("Failed adding item for " - "unknown reason."), BY_SERVER); + SERVER_NOTICE(_("Failed adding item for " + "unknown reason.")) break; } } @@ -222,14 +220,14 @@ void TradeHandler::handleMessage(Net::MessageIn &msg) break; case SMSG_TRADE_CANCEL: - localChatTab->chatLog(_("Trade canceled."), BY_SERVER); + SERVER_NOTICE(_("Trade canceled.")) tradeWindow->setVisible(false); tradeWindow->reset(); PlayerInfo::setTrading(false); break; case SMSG_TRADE_COMPLETE: - localChatTab->chatLog(_("Trade completed."), BY_SERVER); + SERVER_NOTICE(_("Trade completed.")) tradeWindow->setVisible(false); tradeWindow->reset(); PlayerInfo::setTrading(false); |