summaryrefslogtreecommitdiff
path: root/src/gui/requesttrade.cpp
diff options
context:
space:
mode:
authorEugenio Favalli <elvenprogrammer@gmail.com>2005-09-17 13:51:37 +0000
committerEugenio Favalli <elvenprogrammer@gmail.com>2005-09-17 13:51:37 +0000
commite846d4502b59a1a3b8d658a37ae5b5ce4aa1c00c (patch)
tree8feb8b51d731057412a59aeddbbe83b75b09912a /src/gui/requesttrade.cpp
parent3bfcee0d9c033a46fe1b13795d89909c8fb6a239 (diff)
downloadmana-e846d4502b59a1a3b8d658a37ae5b5ce4aa1c00c.tar.gz
mana-e846d4502b59a1a3b8d658a37ae5b5ce4aa1c00c.tar.bz2
mana-e846d4502b59a1a3b8d658a37ae5b5ce4aa1c00c.tar.xz
mana-e846d4502b59a1a3b8d658a37ae5b5ce4aa1c00c.zip
Completed transition to use MessageOut.
Diffstat (limited to 'src/gui/requesttrade.cpp')
-rw-r--r--src/gui/requesttrade.cpp22
1 files changed, 12 insertions, 10 deletions
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 <guichan/widgets/label.hpp>
#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();
}