summaryrefslogtreecommitdiff
path: root/src/gui/inventorywindow.cpp
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2009-03-26 09:55:21 -0600
committerIra Rice <irarice@gmail.com>2009-03-26 09:55:21 -0600
commitf883ad28b77a499fa66497158db425ce1db50f78 (patch)
tree47156bc38c68130d1fb83f8d83b2543375d17d1a /src/gui/inventorywindow.cpp
parent58eb615a589cd6444092f9c928f26210087aa78b (diff)
downloadmana-client-f883ad28b77a499fa66497158db425ce1db50f78.tar.gz
mana-client-f883ad28b77a499fa66497158db425ce1db50f78.tar.bz2
mana-client-f883ad28b77a499fa66497158db425ce1db50f78.tar.xz
mana-client-f883ad28b77a499fa66497158db425ce1db50f78.zip
Some code cleanups (mostly reducing how many calculations need to be
done in certain statements, rearranging arguements to make them look cleaner, or overall making the code slightly more flexible) Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/gui/inventorywindow.cpp')
-rw-r--r--src/gui/inventorywindow.cpp12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index b72a6ff0..fef55b6c 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -122,8 +122,7 @@ void InventoryWindow::logic()
const int usedSlots = player_node->getInventory()->getNumberOfSlotsUsed();
if (mMaxWeight != player_node->mMaxWeight ||
- mTotalWeight != player_node->mTotalWeight ||
- mUsedSlots != usedSlots)
+ mTotalWeight != player_node->mTotalWeight || mUsedSlots != usedSlots)
{
mTotalWeight = player_node->mTotalWeight;
mMaxWeight = player_node->mMaxWeight;
@@ -131,25 +130,18 @@ void InventoryWindow::logic()
// Weight Bar coloration
if (mTotalWeight < (mMaxWeight / 3))
- {
mWeightBar->setColor(0, 0, 255); // Blue
- }
else if (mTotalWeight < ((mMaxWeight / 3) * 2))
- {
mWeightBar->setColor(255, 255, 0); // Yellow
- }
else
- {
mWeightBar->setColor(255, 0, 0); // Red
- }
// Adjust progress bars
mSlotsBar->setProgress((float) mUsedSlots / mMaxSlots);
mWeightBar->setProgress((float) mTotalWeight / mMaxWeight);
mSlotsBar->setText(strprintf("%d/%d", mUsedSlots, mMaxSlots));
- mWeightBar->setText(strprintf("%dg/%dg", mTotalWeight,
- mMaxWeight));
+ mWeightBar->setText(strprintf("%dg/%dg", mTotalWeight, mMaxWeight));
}
}