summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/being.cpp4
-rw-r--r--src/gui/buy.cpp5
-rw-r--r--src/gui/sell.cpp28
3 files changed, 22 insertions, 15 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 8ddd1e89..193582e9 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -523,7 +523,7 @@ Being::getWidth() const
else {
return 0;
}
-};
+}
int
@@ -536,4 +536,4 @@ Being::getHeight() const
else {
return 0;
}
-};
+}
diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp
index 8b9e8d8e..edd3fe2c 100644
--- a/src/gui/buy.cpp
+++ b/src/gui/buy.cpp
@@ -154,7 +154,8 @@ void BuyDialog::action(const gcn::ActionEvent &event)
}
// The following actions require a valid selection
- if (selectedItem < 0 || selectedItem >= int(mShopItems->getNumberOfElements()))
+ if (selectedItem < 0 ||
+ selectedItem >= (int) mShopItems->getNumberOfElements())
{
return;
}
@@ -174,7 +175,7 @@ void BuyDialog::action(const gcn::ActionEvent &event)
mAmountItems = mMaxItems;
}
- mSlider->setValue(double(mAmountItems)/double(mMaxItems));
+ mSlider->setValue((double) mAmountItems / (double) mMaxItems);
updateButtonsAndLabels = true;
}
else if (event.getId() == "-")
diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp
index 5de2a9e6..b5476dd0 100644
--- a/src/gui/sell.cpp
+++ b/src/gui/sell.cpp
@@ -174,12 +174,15 @@ void SellDialog::action(const gcn::ActionEvent &event)
+ toString(mPlayerMoney) + " GP");
mMoneyLabel->adjustSize();
- if (selectedItem > -1) {
+ if (selectedItem > -1)
+ {
mSlider->setEnabled(true);
mIncreaseButton->setEnabled(true);
mMaxItems = mShopItems->at(selectedItem).quantity;
mQuantityLabel->setCaption("0 / " + toString(mMaxItems));
- } else {
+ }
+ else
+ {
mSlider->setEnabled(false);
mIncreaseButton->setEnabled(false);
mQuantityLabel->setCaption("0");
@@ -193,7 +196,8 @@ void SellDialog::action(const gcn::ActionEvent &event)
}
// The following actions require a valid item selection
- if (selectedItem == -1 || selectedItem >= int(mShopItems->getNumberOfElements())) {
+ if (selectedItem == -1 ||
+ selectedItem >= (int) mShopItems->getNumberOfElements()) {
return;
}
@@ -201,14 +205,14 @@ void SellDialog::action(const gcn::ActionEvent &event)
if (event.getId() == "mSlider")
{
- mAmountItems = (int)(mSlider->getValue() * mMaxItems);
+ mAmountItems = (int) (mSlider->getValue() * mMaxItems);
updateButtonsAndLabels = true;
}
else if (event.getId() == "+")
{
assert(mAmountItems < mMaxItems);
mAmountItems++;
- mSlider->setValue(double(mAmountItems)/double(mMaxItems));
+ mSlider->setValue((double) mAmountItems /(double) mMaxItems);
updateButtonsAndLabels = true;
}
@@ -217,7 +221,7 @@ void SellDialog::action(const gcn::ActionEvent &event)
assert(mAmountItems > 0);
mAmountItems--;
- mSlider->setValue(double(mAmountItems)/double(mMaxItems));
+ mSlider->setValue((double) mAmountItems / (double) mMaxItems);
updateButtonsAndLabels = true;
}
@@ -240,15 +244,16 @@ void SellDialog::action(const gcn::ActionEvent &event)
mSlider->setEnabled(mMaxItems != 0);
// All were sold
- if (!mMaxItems) {
-
+ if (!mMaxItems)
+ {
mShopItemList->setSelected(-1);
- mShopItems->getShop()->erase(mShopItems->getShop()->begin() + selectedItem);
+ mShopItems->getShop()->erase(
+ mShopItems->getShop()->begin() + selectedItem);
}
// Update only when there are items left, the entry doesn't exist
// otherwise and can't be updated
- updateButtonsAndLabels = bool(mMaxItems);
+ updateButtonsAndLabels = mMaxItems != 0;
}
// If anything changed, we need to update the buttons and labels
@@ -260,7 +265,8 @@ void SellDialog::action(const gcn::ActionEvent &event)
mIncreaseButton->setEnabled(mAmountItems < mMaxItems);
// Update labels
- mQuantityLabel->setCaption(toString(mAmountItems) + " / " + toString(mMaxItems));
+ mQuantityLabel->setCaption(
+ toString(mAmountItems) + " / " + toString(mMaxItems));
mQuantityLabel->adjustSize();
int sellSum = mAmountItems * mShopItems->at(selectedItem).price;