summaryrefslogtreecommitdiff
path: root/src/gui/buy.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/buy.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/buy.cpp')
-rw-r--r--src/gui/buy.cpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp
index 18542385..86bd5413 100644
--- a/src/gui/buy.cpp
+++ b/src/gui/buy.cpp
@@ -23,8 +23,6 @@
#include "buy.h"
-#include <sstream>
-
#include <guichan/widgets/label.hpp>
#include "button.h"
@@ -41,6 +39,8 @@
#include "../net/messageout.h"
#include "../net/protocol.h"
+#include "../utils/tostring.h"
+
BuyDialog::BuyDialog(Network *network):
Window("Buy"), mNetwork(network),
@@ -139,10 +139,8 @@ void BuyDialog::reset()
void BuyDialog::addItem(short id, int price)
{
ITEM_SHOP item_shop;
- std::stringstream ss;
- ss << itemDb->getItemInfo(id)->getName() << " " << price << " GP";
- item_shop.name = ss.str();
+ item_shop.name = itemDb->getItemInfo(id)->getName() + " " + toString(price) + " GP";
item_shop.price = price;
item_shop.id = id;
@@ -242,21 +240,17 @@ void BuyDialog::action(const std::string& eventId)
// If anything has changed, we have to update the buttons and labels
if (updateButtonsAndLabels) {
- std::stringstream oss;
-
// Update buttons
mIncreaseButton->setEnabled(mAmountItems < mMaxItems);
mDecreaseButton->setEnabled(mAmountItems > 0);
mBuyButton->setEnabled(mAmountItems > 0);
// Update labels
- oss << mAmountItems;
- mQuantityLabel->setCaption(oss.str());
+ mQuantityLabel->setCaption(toString(mAmountItems));
mQuantityLabel->adjustSize();
- oss.str("");
- oss << "Price : " << mAmountItems * mShopItems->at(selectedItem).price << " GP";
- mMoneyLabel->setCaption(oss.str());
+ int price = mAmountItems * mShopItems->at(selectedItem).price;
+ mMoneyLabel->setCaption("Price : " + toString(price) + " GP");
mMoneyLabel->adjustSize();
}
}