summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
authorAndrej Sinicyn <andrej4000@gmail.com>2005-07-31 13:45:18 +0000
committerAndrej Sinicyn <andrej4000@gmail.com>2005-07-31 13:45:18 +0000
commit2ec5340b9c5f80094fdce43fa7735d3af5d5982f (patch)
tree8ab197eb9f34571b3976c0b7730c29b81ea3516c /src/game.cpp
parentf4c6961e25dca3e683b6920e33bb0dc74464c88b (diff)
downloadmana-2ec5340b9c5f80094fdce43fa7735d3af5d5982f.tar.gz
mana-2ec5340b9c5f80094fdce43fa7735d3af5d5982f.tar.bz2
mana-2ec5340b9c5f80094fdce43fa7735d3af5d5982f.tar.xz
mana-2ec5340b9c5f80094fdce43fa7735d3af5d5982f.zip
Don't allow more than one trade dialog at once; if a trade is canceled on the other side, close the trade window.
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp13
1 files changed, 13 insertions, 0 deletions
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