summaryrefslogtreecommitdiff
path: root/src/gui/trade.cpp
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2006-01-22 13:31:13 +0000
committerBjörn Steinbrink <B.Steinbrink@gmx.de>2006-01-22 13:31:13 +0000
commitbd56bf8afdab16383ed8ad08412a8c807f84af85 (patch)
tree0e963ada63bcbe3c50dd77986aaa15b9ba49816a /src/gui/trade.cpp
parent5359640b6f271af31f6423df9d661433eff89a3e (diff)
downloadmana-bd56bf8afdab16383ed8ad08412a8c807f84af85.tar.gz
mana-bd56bf8afdab16383ed8ad08412a8c807f84af85.tar.bz2
mana-bd56bf8afdab16383ed8ad08412a8c807f84af85.tar.xz
mana-bd56bf8afdab16383ed8ad08412a8c807f84af85.zip
Merged NETWORK branch (includes BEING_OVERHAUL).
Diffstat (limited to 'src/gui/trade.cpp')
-rw-r--r--src/gui/trade.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp
index 767888f4..f7286fd2 100644
--- a/src/gui/trade.cpp
+++ b/src/gui/trade.cpp
@@ -43,8 +43,9 @@
#include "../resources/iteminfo.h"
-TradeWindow::TradeWindow():
- Window("Trade: You")
+TradeWindow::TradeWindow(Network *network):
+ Window("Trade: You"),
+ mNetwork(network)
{
setContentSize(322, 150);
@@ -186,8 +187,8 @@ void TradeWindow::increaseQuantity(int index, bool own, int quantity)
void TradeWindow::reset()
{
- myInventory->resetItems();
- partnerInventory->resetItems();
+ myInventory->clear();
+ partnerInventory->clear();
tradeButton->setEnabled(false);
okButton->setEnabled(true);
ok_other = false;
@@ -227,7 +228,7 @@ void TradeWindow::receivedOk(bool own)
void TradeWindow::tradeItem(Item *item, int quantity)
{
- MessageOut outMsg;
+ MessageOut outMsg(mNetwork);
outMsg.writeInt16(CMSG_TRADE_ITEM_ADD_REQUEST);
outMsg.writeInt16(item->getInvIndex());
outMsg.writeInt32(quantity);
@@ -299,7 +300,7 @@ void TradeWindow::action(const std::string &eventId)
}
else if (eventId == "cancel")
{
- MessageOut outMsg;
+ MessageOut outMsg(mNetwork);
outMsg.writeInt16(CMSG_TRADE_CANCEL_REQUEST);
}
else if (eventId == "ok")
@@ -312,7 +313,7 @@ void TradeWindow::action(const std::string &eventId)
tempMoney[1] << tempInt;
moneyField->setText(tempMoney[1].str());
- MessageOut outMsg;
+ MessageOut outMsg(mNetwork);
outMsg.writeInt16(CMSG_TRADE_ITEM_ADD_REQUEST);
outMsg.writeInt16(0);
outMsg.writeInt32(tempInt);
@@ -320,12 +321,12 @@ void TradeWindow::action(const std::string &eventId)
moneyField->setText("");
}
moneyField->setEnabled(false);
- MessageOut outMsg;
+ MessageOut outMsg(mNetwork);
outMsg.writeInt16(CMSG_TRADE_ADD_COMPLETE);
}
else if (eventId == "trade")
{
- MessageOut outMsg;
+ MessageOut outMsg(mNetwork);
outMsg.writeInt16(CMSG_TRADE_OK);
}
}