diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-07-13 20:19:57 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-07-13 20:19:57 -0600 |
commit | feb73c9a8dcaf9ebd30ad8b00ce08cf41ca65849 (patch) | |
tree | 210dc96fdbf580fde9aa81a16b7d1baacd5dc159 /src | |
parent | 666211542df4fd4fb0f9a1c936b54f6405ef09ba (diff) | |
download | mana-client-feb73c9a8dcaf9ebd30ad8b00ce08cf41ca65849.tar.gz mana-client-feb73c9a8dcaf9ebd30ad8b00ce08cf41ca65849.tar.bz2 mana-client-feb73c9a8dcaf9ebd30ad8b00ce08cf41ca65849.tar.xz mana-client-feb73c9a8dcaf9ebd30ad8b00ce08cf41ca65849.zip |
Move some functions into better places
Diffstat (limited to 'src')
-rw-r--r-- | src/net/tmwserv/gameserver/player.cpp | 20 | ||||
-rw-r--r-- | src/net/tmwserv/gameserver/player.h | 3 | ||||
-rw-r--r-- | src/net/tmwserv/tradehandler.cpp | 12 |
3 files changed, 9 insertions, 26 deletions
diff --git a/src/net/tmwserv/gameserver/player.cpp b/src/net/tmwserv/gameserver/player.cpp index 733b7cdc..10ffdcda 100644 --- a/src/net/tmwserv/gameserver/player.cpp +++ b/src/net/tmwserv/gameserver/player.cpp @@ -57,26 +57,6 @@ void Net::GameServer::Player::useSpecial(int special) Net::GameServer::connection->send(msg); } -void Net::GameServer::Player::requestTrade(int id) -{ - MessageOut msg(PGMSG_TRADE_REQUEST); - msg.writeInt16(id); - Net::GameServer::connection->send(msg); -} - -void Net::GameServer::Player::acceptTrade(bool accept) -{ - MessageOut msg(accept ? PGMSG_TRADE_REQUEST : PGMSG_TRADE_CANCEL); - Net::GameServer::connection->send(msg); -} - -void Net::GameServer::Player::tradeMoney(int amount) -{ - MessageOut msg(PGMSG_TRADE_SET_MONEY); - msg.writeInt32(amount); - Net::GameServer::connection->send(msg); -} - void Net::GameServer::Player::raiseAttribute(int attribute) { MessageOut msg(PGMSG_RAISE_ATTRIBUTE); diff --git a/src/net/tmwserv/gameserver/player.h b/src/net/tmwserv/gameserver/player.h index 76d7844b..b6a51ef0 100644 --- a/src/net/tmwserv/gameserver/player.h +++ b/src/net/tmwserv/gameserver/player.h @@ -43,9 +43,6 @@ namespace Net void walk(int x, int y); void moveItem(int oldSlot, int newSlot, int amount); void useSpecial(int special); - void requestTrade(int id); - void acceptTrade(bool accept); - void tradeMoney(int amount); void raiseAttribute(int attribute); void lowerAttribute(int attribute); void respawn(); diff --git a/src/net/tmwserv/tradehandler.cpp b/src/net/tmwserv/tradehandler.cpp index aabd8b2a..55a00d4c 100644 --- a/src/net/tmwserv/tradehandler.cpp +++ b/src/net/tmwserv/tradehandler.cpp @@ -55,7 +55,11 @@ namespace { void action(const gcn::ActionEvent &event) { if (event.getId() == "yes") - Net::GameServer::Player::requestTrade(tradePartnerID); + { + MessageOut msg(PGMSG_TRADE_REQUEST); + msg.writeInt16(tradePartnerID); + Net::GameServer::connection->send(msg); + } else Net::getTradeHandler()->cancel(); } @@ -105,7 +109,7 @@ void TradeHandler::handleMessage(MessageIn &msg) Being *being = beingManager->findBeing(msg.readInt16()); if (!being || !mAcceptTradeRequests) { - Net::GameServer::Player::acceptTrade(false); + respond(false); break; } player_node->setTrading(true); @@ -171,7 +175,9 @@ void TradeHandler::request(Being *being) void TradeHandler::respond(bool accept) { - // TODO + MessageOut msg(accept ? PGMSG_TRADE_REQUEST : PGMSG_TRADE_CANCEL); + Net::GameServer::connection->send(msg); + if (!accept) player_node->setTrading(false); } |