summaryrefslogtreecommitdiff
path: root/src/gui/tradewindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/tradewindow.cpp')
-rw-r--r--src/gui/tradewindow.cpp24
1 files changed, 7 insertions, 17 deletions
diff --git a/src/gui/tradewindow.cpp b/src/gui/tradewindow.cpp
index db4b6490..e24845b7 100644
--- a/src/gui/tradewindow.cpp
+++ b/src/gui/tradewindow.cpp
@@ -24,7 +24,6 @@
#include "event.h"
#include "inventory.h"
#include "item.h"
-#include "localplayer.h"
#include "playerinfo.h"
#include "units.h"
@@ -39,7 +38,6 @@
#include "gui/widgets/textfield.h"
#include "gui/widgets/layout.h"
-#include "net/inventoryhandler.h"
#include "net/net.h"
#include "net/tradehandler.h"
@@ -48,8 +46,6 @@
#include <guichan/font.hpp>
-#include <sstream>
-
#define CAPTION_PROPOSE _("Propose trade")
#define CAPTION_CONFIRMED _("Confirmed. Waiting...")
#define CAPTION_ACCEPT _("Agree trade")
@@ -125,9 +121,7 @@ TradeWindow::TradeWindow():
reset();
}
-TradeWindow::~TradeWindow()
-{
-}
+TradeWindow::~TradeWindow() = default;
void TradeWindow::setMoney(int amount)
{
@@ -138,7 +132,10 @@ void TradeWindow::setMoney(int amount)
void TradeWindow::addItem(int id, bool own, int quantity)
{
- (own ? mMyInventory : mPartnerInventory)->addItem(id, quantity);
+ if (own)
+ mMyInventory->addItem(id, quantity);
+ else
+ mPartnerInventory->addItem(id, quantity);
}
void TradeWindow::changeQuantity(int index, bool own, int quantity)
@@ -186,22 +183,15 @@ void TradeWindow::receivedOk(bool own)
}
}
-void TradeWindow::tradeItem(Item *item, int quantity)
-{
- Net::getTradeHandler()->addItem(item, quantity);
-}
-
void TradeWindow::valueChanged(const gcn::SelectionEvent &event)
{
- const Item *item;
-
/* If an item is selected in one container, make sure no item is selected
* in the other container.
*/
if (event.getSource() == mMyItemContainer &&
- (item = mMyItemContainer->getSelectedItem()))
+ mMyItemContainer->getSelectedItem())
mPartnerItemContainer->selectNone();
- else if ((item = mPartnerItemContainer->getSelectedItem()))
+ else if (mPartnerItemContainer->getSelectedItem())
mMyItemContainer->selectNone();
}