From 3ddaec5f355ed1d231514cf0a863c4b9e35cf2a6 Mon Sep 17 00:00:00 2001 From: Björn Steinbrink Date: Sun, 19 Mar 2006 15:09:27 +0000 Subject: Reverted changeset r2269 (toString) as requested by ElvenProgrammer. --- src/gui/buy.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/gui/buy.cpp') diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp index 86bd5413..18542385 100644 --- a/src/gui/buy.cpp +++ b/src/gui/buy.cpp @@ -23,6 +23,8 @@ #include "buy.h" +#include + #include #include "button.h" @@ -39,8 +41,6 @@ #include "../net/messageout.h" #include "../net/protocol.h" -#include "../utils/tostring.h" - BuyDialog::BuyDialog(Network *network): Window("Buy"), mNetwork(network), @@ -139,8 +139,10 @@ void BuyDialog::reset() void BuyDialog::addItem(short id, int price) { ITEM_SHOP item_shop; + std::stringstream ss; - item_shop.name = itemDb->getItemInfo(id)->getName() + " " + toString(price) + " GP"; + ss << itemDb->getItemInfo(id)->getName() << " " << price << " GP"; + item_shop.name = ss.str(); item_shop.price = price; item_shop.id = id; @@ -240,17 +242,21 @@ 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 - mQuantityLabel->setCaption(toString(mAmountItems)); + oss << mAmountItems; + mQuantityLabel->setCaption(oss.str()); mQuantityLabel->adjustSize(); - int price = mAmountItems * mShopItems->at(selectedItem).price; - mMoneyLabel->setCaption("Price : " + toString(price) + " GP"); + oss.str(""); + oss << "Price : " << mAmountItems * mShopItems->at(selectedItem).price << " GP"; + mMoneyLabel->setCaption(oss.str()); mMoneyLabel->adjustSize(); } } -- cgit v1.2.3-70-g09d2