summaryrefslogtreecommitdiff
path: root/src/gui/trade.cpp
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2006-03-18 14:47:14 +0000
committerBjörn Steinbrink <B.Steinbrink@gmx.de>2006-03-18 14:47:14 +0000
commitab678324e3d73e2354cef331624ecef7cfc03203 (patch)
tree29394a5aca6e59f817f7cfa3b9281891a273d259 /src/gui/trade.cpp
parent32badd4b6f843cb74fdc3238fe92119518c8c0ab (diff)
downloadmana-ab678324e3d73e2354cef331624ecef7cfc03203.tar.gz
mana-ab678324e3d73e2354cef331624ecef7cfc03203.tar.bz2
mana-ab678324e3d73e2354cef331624ecef7cfc03203.tar.xz
mana-ab678324e3d73e2354cef331624ecef7cfc03203.zip
Added a toString conversion function.
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);