diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2008-02-12 09:54:42 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2008-02-12 09:54:42 +0000 |
commit | 078a31f906b618c1526b98ba63043a2267a858c6 (patch) | |
tree | 18f0f5a6f4b4b58c25a74f999b421ef0030c0351 /src/net/tradehandler.cpp | |
parent | 14f0d53fa3bfeb6aea6d42295317b325ccb089e4 (diff) | |
download | mana-078a31f906b618c1526b98ba63043a2267a858c6.tar.gz mana-078a31f906b618c1526b98ba63043a2267a858c6.tar.bz2 mana-078a31f906b618c1526b98ba63043a2267a858c6.tar.xz mana-078a31f906b618c1526b98ba63043a2267a858c6.zip |
Merged revisions 3619 via svnmerge from
https://themanaworld.svn.sourceforge.net/svnroot/themanaworld/tmw/branches/0.0
........
r3619 | b_lindeijer | 2007-10-18 12:56:40 +0200 (Thu, 18 Oct 2007) | 3 lines
Implemented automatic denying of trade requests based on a patch
submitted by Quiche_on_a_leash.
........
Diffstat (limited to 'src/net/tradehandler.cpp')
-rw-r--r-- | src/net/tradehandler.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/net/tradehandler.cpp b/src/net/tradehandler.cpp index b659f8a4..d75350bc 100644 --- a/src/net/tradehandler.cpp +++ b/src/net/tradehandler.cpp @@ -55,7 +55,8 @@ namespace { } listener; } -TradeHandler::TradeHandler() +TradeHandler::TradeHandler(): + mAcceptTradeRequests(true) { static const Uint16 _messages[] = { GPMSG_TRADE_REQUEST, @@ -70,6 +71,16 @@ TradeHandler::TradeHandler() handledMessages = _messages; } +void TradeHandler::setAcceptTradeRequests(bool acceptTradeRequests) +{ + mAcceptTradeRequests = acceptTradeRequests; + if (mAcceptTradeRequests) { + chatWindow->chatLog("Accepting incoming trade requests", BY_SERVER); + } else { + chatWindow->chatLog("Ignoring incoming trade requests", BY_SERVER); + } +} + void TradeHandler::handleMessage(MessageIn &msg) { switch (msg.getId()) @@ -77,7 +88,7 @@ void TradeHandler::handleMessage(MessageIn &msg) case GPMSG_TRADE_REQUEST: { Being *being = beingManager->findBeing(msg.readInt16()); - if (!being) + if (!being || !mAcceptTradeRequests) { Net::GameServer::Player::acceptTrade(false); break; |