diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-04-06 22:46:15 +0200 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-04-06 22:46:15 +0200 |
commit | f0fd20fdd649eb61fa0d2444d910a2b0882e3580 (patch) | |
tree | ee879af37c773e8a40b353e6e1e714ab5e1f45b1 /src/net/tmwserv/tradehandler.cpp | |
parent | 7ee2220427d8735c777f504517c24c49afda699f (diff) | |
download | mana-f0fd20fdd649eb61fa0d2444d910a2b0882e3580.tar.gz mana-f0fd20fdd649eb61fa0d2444d910a2b0882e3580.tar.bz2 mana-f0fd20fdd649eb61fa0d2444d910a2b0882e3580.tar.xz mana-f0fd20fdd649eb61fa0d2444d910a2b0882e3580.zip |
Moved many MessageOut constructions around
No real point in having these abstracted away twice. We're using network
interfaces now instead of functions structured in namespaces.
Diffstat (limited to 'src/net/tmwserv/tradehandler.cpp')
-rw-r--r-- | src/net/tmwserv/tradehandler.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/net/tmwserv/tradehandler.cpp b/src/net/tmwserv/tradehandler.cpp index 17a45a19..4528988b 100644 --- a/src/net/tmwserv/tradehandler.cpp +++ b/src/net/tmwserv/tradehandler.cpp @@ -21,10 +21,15 @@ #include "net/tmwserv/tradehandler.h" +#include "net/tmwserv/gameserver/internal.h" #include "net/tmwserv/gameserver/player.h" + +#include "net/tmwserv/connection.h" #include "net/tmwserv/protocol.h" #include "net/messagein.h" +#include "net/messageout.h" +#include "net/net.h" #include "beingmanager.h" #include "item.h" @@ -49,7 +54,7 @@ namespace { if (event.getId() == "yes") Net::GameServer::Player::requestTrade(tradePartnerID); else - Net::GameServer::Player::acceptTrade(false); + Net::getTradeHandler()->cancel(); } } listener; } @@ -146,7 +151,10 @@ void TradeHandler::request(Being *being) { tradePartnerName = being->getName(); tradePartnerID = being->getId(); - Net::GameServer::Player::requestTrade(tradePartnerID); + + MessageOut msg(PGMSG_TRADE_REQUEST); + msg.writeInt16(tradePartnerID); + Net::GameServer::connection->send(msg); } void TradeHandler::respond(bool accept) @@ -156,7 +164,11 @@ void TradeHandler::respond(bool accept) void TradeHandler::addItem(Item *item, int amount) { - Net::GameServer::Player::tradeItem(item->getInvIndex(), amount); + MessageOut msg(PGMSG_TRADE_ADD_ITEM); + msg.writeInt8(item->getInvIndex()); + msg.writeInt8(amount); + Net::GameServer::connection->send(msg); + tradeWindow->addItem(item->getId(), true, amount); item->increaseQuantity(-amount); } @@ -183,7 +195,8 @@ void TradeHandler::finish() void TradeHandler::cancel() { - Net::GameServer::Player::acceptTrade(false); + MessageOut msg(PGMSG_TRADE_CANCEL); + Net::GameServer::connection->send(msg); } } // namespace TmwServ |