diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-11-03 12:06:48 -0700 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-11-03 12:06:48 -0700 |
commit | e07e2a6db902f2ce0095b65708a98fa4dbf40aa0 (patch) | |
tree | b91b3e3d3f06199dcc34e32834941964a263e0be /src/net/manaserv/tradehandler.cpp | |
parent | e2897e4a7cb7eb0c4a7e46d72a9a19b909368c26 (diff) | |
download | mana-e07e2a6db902f2ce0095b65708a98fa4dbf40aa0.tar.gz mana-e07e2a6db902f2ce0095b65708a98fa4dbf40aa0.tar.bz2 mana-e07e2a6db902f2ce0095b65708a98fa4dbf40aa0.tar.xz mana-e07e2a6db902f2ce0095b65708a98fa4dbf40aa0.zip |
Simplify ManaServ netcode some more
Diffstat (limited to 'src/net/manaserv/tradehandler.cpp')
-rw-r--r-- | src/net/manaserv/tradehandler.cpp | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/src/net/manaserv/tradehandler.cpp b/src/net/manaserv/tradehandler.cpp index 46664193..bcfe20e9 100644 --- a/src/net/manaserv/tradehandler.cpp +++ b/src/net/manaserv/tradehandler.cpp @@ -21,9 +21,6 @@ #include "net/manaserv/tradehandler.h" -#include "net/manaserv/gameserver/internal.h" -#include "net/manaserv/gameserver/player.h" - #include "net/manaserv/connection.h" #include "net/manaserv/messagein.h" #include "net/manaserv/messageout.h" @@ -46,6 +43,12 @@ std::string tradePartnerName; int tradePartnerID; +Net::TradeHandler *tradeHandler; + +namespace ManaServ { + +extern Connection *gameServerConnection; + /** * Listener for request trade dialogs */ @@ -58,7 +61,7 @@ namespace { { ManaServ::MessageOut msg(PGMSG_TRADE_REQUEST); msg.writeInt16(tradePartnerID); - ManaServ::GameServer::connection->send(msg); + gameServerConnection->send(msg); } else Net::getTradeHandler()->cancel(); @@ -66,10 +69,6 @@ namespace { } listener; } -Net::TradeHandler *tradeHandler; - -namespace ManaServ { - TradeHandler::TradeHandler(): mAcceptTradeRequests(true) { @@ -170,13 +169,13 @@ void TradeHandler::request(Being *being) MessageOut msg(PGMSG_TRADE_REQUEST); msg.writeInt16(tradePartnerID); - GameServer::connection->send(msg); + gameServerConnection->send(msg); } void TradeHandler::respond(bool accept) { MessageOut msg(accept ? PGMSG_TRADE_REQUEST : PGMSG_TRADE_CANCEL); - GameServer::connection->send(msg); + gameServerConnection->send(msg); if (!accept) player_node->setTrading(false); @@ -187,7 +186,7 @@ void TradeHandler::addItem(Item *item, int amount) MessageOut msg(PGMSG_TRADE_ADD_ITEM); msg.writeInt8(item->getInvIndex()); msg.writeInt8(amount); - GameServer::connection->send(msg); + gameServerConnection->send(msg); tradeWindow->addItem(item->getId(), true, amount); item->increaseQuantity(-amount); @@ -202,25 +201,25 @@ void TradeHandler::setMoney(int amount) { MessageOut msg(PGMSG_TRADE_SET_MONEY); msg.writeInt32(amount); - GameServer::connection->send(msg); + gameServerConnection->send(msg); } void TradeHandler::confirm() { MessageOut msg(PGMSG_TRADE_CONFIRM); - GameServer::connection->send(msg); + gameServerConnection->send(msg); } void TradeHandler::finish() { MessageOut msg(PGMSG_TRADE_AGREED); - GameServer::connection->send(msg); + gameServerConnection->send(msg); } void TradeHandler::cancel() { MessageOut msg(PGMSG_TRADE_CANCEL); - GameServer::connection->send(msg); + gameServerConnection->send(msg); } } // namespace ManaServ |