summaryrefslogtreecommitdiff
path: root/src/gui/trade.cpp
diff options
context:
space:
mode:
authorRonny Pfannschmidt <r0nny@users.sourceforge.net>2006-01-03 21:43:54 +0000
committerRonny Pfannschmidt <r0nny@users.sourceforge.net>2006-01-03 21:43:54 +0000
commit5bcc5490c6dd2cf5535ab283292217302e402ee7 (patch)
treed9ebdec29d65709f2aa354e450ec363f45c6af59 /src/gui/trade.cpp
parent2d58eee5901e866fe994c19d38d9dca3383fab37 (diff)
downloadmana-client-5bcc5490c6dd2cf5535ab283292217302e402ee7.tar.gz
mana-client-5bcc5490c6dd2cf5535ab283292217302e402ee7.tar.bz2
mana-client-5bcc5490c6dd2cf5535ab283292217302e402ee7.tar.xz
mana-client-5bcc5490c6dd2cf5535ab283292217302e402ee7.zip
moved network logic out of gui/trade.cpp to net/protocol_trade.{h,cpp}
Diffstat (limited to 'src/gui/trade.cpp')
-rw-r--r--src/gui/trade.cpp23
1 files changed, 8 insertions, 15 deletions
diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp
index 767888f4..359782d4 100644
--- a/src/gui/trade.cpp
+++ b/src/gui/trade.cpp
@@ -39,7 +39,8 @@
#include "../item.h"
#include "../net/messageout.h"
-#include "../net/protocol.h"
+#include "../net/protocol_trade.h"
+
#include "../resources/iteminfo.h"
@@ -227,10 +228,7 @@ void TradeWindow::receivedOk(bool own)
void TradeWindow::tradeItem(Item *item, int quantity)
{
- MessageOut outMsg;
- outMsg.writeInt16(CMSG_TRADE_ITEM_ADD_REQUEST);
- outMsg.writeInt16(item->getInvIndex());
- outMsg.writeInt32(quantity);
+ trade(*item,quantity);
}
void TradeWindow::mouseClick(int x, int y, int button, int count)
@@ -299,8 +297,7 @@ void TradeWindow::action(const std::string &eventId)
}
else if (eventId == "cancel")
{
- MessageOut outMsg;
- outMsg.writeInt16(CMSG_TRADE_CANCEL_REQUEST);
+ trade(cancel);
}
else if (eventId == "ok")
{
@@ -312,20 +309,16 @@ void TradeWindow::action(const std::string &eventId)
tempMoney[1] << tempInt;
moneyField->setText(tempMoney[1].str());
- MessageOut outMsg;
- outMsg.writeInt16(CMSG_TRADE_ITEM_ADD_REQUEST);
- outMsg.writeInt16(0);
- outMsg.writeInt32(tempInt);
+ trade(tempInt);
+
} else {
moneyField->setText("");
}
moneyField->setEnabled(false);
- MessageOut outMsg;
- outMsg.writeInt16(CMSG_TRADE_ADD_COMPLETE);
+ trade(complete);
}
else if (eventId == "trade")
{
- MessageOut outMsg;
- outMsg.writeInt16(CMSG_TRADE_OK);
+ trade();
}
}