diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2007-05-23 20:14:14 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2007-05-23 20:14:14 +0000 |
commit | c61786006bf7694f532c77d038fc2cfd8a44b551 (patch) | |
tree | 130063591c791b70dc426f3d3294c615ad0d7ef5 /src | |
parent | 2d40625bd3229a6d9a6a859296d204a9816fc1fd (diff) | |
download | mana-c61786006bf7694f532c77d038fc2cfd8a44b551.tar.gz mana-c61786006bf7694f532c77d038fc2cfd8a44b551.tar.bz2 mana-c61786006bf7694f532c77d038fc2cfd8a44b551.tar.xz mana-c61786006bf7694f532c77d038fc2cfd8a44b551.zip |
A bunch of lingering syntactical changes.
Diffstat (limited to 'src')
-rw-r--r-- | src/being.cpp | 4 | ||||
-rw-r--r-- | src/gui/buy.cpp | 5 | ||||
-rw-r--r-- | src/gui/sell.cpp | 28 |
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; |