summaryrefslogtreecommitdiff
path: root/src/gui/buy.cpp
diff options
context:
space:
mode:
authorEugenio Favalli <elvenprogrammer@gmail.com>2006-03-19 20:43:10 +0000
committerEugenio Favalli <elvenprogrammer@gmail.com>2006-03-19 20:43:10 +0000
commit654d24e74c56d240b8d622840c135e22a029636d (patch)
tree5eb8b94f7832bdbb6d21c7ded6e6da6b5f8f3464 /src/gui/buy.cpp
parent3ddaec5f355ed1d231514cf0a863c4b9e35cf2a6 (diff)
downloadmana-654d24e74c56d240b8d622840c135e22a029636d.tar.gz
mana-654d24e74c56d240b8d622840c135e22a029636d.tar.bz2
mana-654d24e74c56d240b8d622840c135e22a029636d.tar.xz
mana-654d24e74c56d240b8d622840c135e22a029636d.zip
Unreverted latest change by Doener due to my lack of proper communication abilities.
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();
}
}