From 2ec5340b9c5f80094fdce43fa7735d3af5d5982f Mon Sep 17 00:00:00 2001 From: Andrej Sinicyn Date: Sun, 31 Jul 2005 13:45:18 +0000 Subject: Don't allow more than one trade dialog at once; if a trade is canceled on the other side, close the trade window. --- src/game.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/game.cpp') diff --git a/src/game.cpp b/src/game.cpp index 191141a8..24fe3723 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1078,6 +1078,18 @@ void do_parse() // Trade: Receiving a request to trade case 0x00e5: + // If a trade window is already open, send a trade cancel + // to any other trade request. + // It would still be nice to implement an independent message + // that the person you want to trade with can't do that now. + if (tradeWindow->isVisible() == true) + { + // 0xff packet means cancel + WFIFOW(0) = net_w_value(0x00e6); + WFIFOB(2) = net_b_value(4); + WFIFOSET(3); + break; + } new RequestTradeDialog(RFIFOP(2)); break; @@ -1105,6 +1117,7 @@ void do_parse() case 4: // Trade cancelled chatWindow->chat_log("Trade cancelled.", BY_SERVER); + tradeWindow->setVisible(false); break; default: // Shouldn't happen as well, but to be sure -- cgit v1.2.3-70-g09d2