From e846d4502b59a1a3b8d658a37ae5b5ce4aa1c00c Mon Sep 17 00:00:00 2001 From: Eugenio Favalli Date: Sat, 17 Sep 2005 13:51:37 +0000 Subject: Completed transition to use MessageOut. --- src/gui/requesttrade.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'src/gui/requesttrade.cpp') diff --git a/src/gui/requesttrade.cpp b/src/gui/requesttrade.cpp index e3b70fd3..992b0c0f 100644 --- a/src/gui/requesttrade.cpp +++ b/src/gui/requesttrade.cpp @@ -27,7 +27,10 @@ #include #include "button.h" + +#include "../net/messageout.h" #include "../net/network.h" +#include "../net/protocol.h" bool requestTradeDialogOpen = false; @@ -84,19 +87,18 @@ RequestTradeDialog::~RequestTradeDialog() void RequestTradeDialog::action(const std::string& eventId) { + int choice = 4; // 4 means trade canceled + if (eventId == "accept") { - // Send the selected index back to the server - writeWord(0, 0x00e6); - writeByte(2, 3); - writeSet(3); - scheduleDelete(); + choice = 3; // ok to trade } else if (eventId == "cancel") { - // 0xff packet means cancel - writeWord(0, 0x00e6); - writeByte(2, 4); - writeSet(3); requestTradeDialogOpen = false; - scheduleDelete(); } + + MessageOut outMsg; + outMsg.writeShort(CMSG_TRADE_RESPONSE); + outMsg.writeByte(choice); + writeSet(3); + scheduleDelete(); } -- cgit v1.2.3-70-g09d2