summaryrefslogtreecommitdiff
path: root/src/gui/buy.cpp
diff options
context:
space:
mode:
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();
}
}