summaryrefslogtreecommitdiff
path: root/src/gui/trade.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/trade.cpp')
-rw-r--r--src/gui/trade.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp
index ee7bca06..9b98fa09 100644
--- a/src/gui/trade.cpp
+++ b/src/gui/trade.cpp
@@ -43,6 +43,8 @@
#include "../resources/iteminfo.h"
+#include "../utils/tostring.h"
+
TradeWindow::TradeWindow(Network *network):
Window("Trade: You"),
mNetwork(network),
@@ -130,9 +132,7 @@ TradeWindow::~TradeWindow()
void TradeWindow::addMoney(int amount)
{
- std::stringstream tempMoney;
- tempMoney << "You get: " << amount << "z";
- mMoneyLabel->setCaption(tempMoney.str());
+ mMoneyLabel->setCaption("You get: " + toString(amount) + "z");
mMoneyLabel->adjustSize();
}
@@ -292,14 +292,12 @@ void TradeWindow::action(const std::string &eventId)
}
else if (eventId == "ok")
{
- std::stringstream tempMoney[2];
- tempMoney[0] << mMoneyField->getText();
+ std::stringstream tempMoney(mMoneyField->getText());
int tempInt;
- if (tempMoney[0] >> tempInt)
+ if (tempMoney >> tempInt)
{
- tempMoney[1] << tempInt;
- mMoneyField->setText(tempMoney[1].str());
-
+ mMoneyField->setText(toString(tempInt));
+
MessageOut outMsg(mNetwork);
outMsg.writeInt16(CMSG_TRADE_ITEM_ADD_REQUEST);
outMsg.writeInt16(0);