summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBertram <bertram@cegetel.net>2009-07-25 01:27:31 +0200
committerBertram <bertram@cegetel.net>2009-07-25 01:27:31 +0200
commit2c93d5449517c1e1d62d813034a0c1406867aa7d (patch)
treec0b86a79c484a26cb0a5794dd5449619ae334125
parent34d5b7d7a1b176a9665b9cdd5e8bc42bfdb83073 (diff)
downloadmana-2c93d5449517c1e1d62d813034a0c1406867aa7d.tar.gz
mana-2c93d5449517c1e1d62d813034a0c1406867aa7d.tar.bz2
mana-2c93d5449517c1e1d62d813034a0c1406867aa7d.tar.xz
mana-2c93d5449517c1e1d62d813034a0c1406867aa7d.zip
Fixed the XP bars strange behaviour.
By wrapping a bit more the values given at load time.
-rw-r--r--src/gui/widgets/progressbar.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp
index 359cbf49..7cc020ef 100644
--- a/src/gui/widgets/progressbar.cpp
+++ b/src/gui/widgets/progressbar.cpp
@@ -43,13 +43,17 @@ ProgressBar::ProgressBar(float progress,
int width, int height,
const gcn::Color &color):
gcn::Widget(),
- mProgress(progress),
- mProgressToGo(progress),
mSmoothProgress(true),
mColor(color),
mColorToGo(color),
mSmoothColorChange(true)
{
+ // The progress value is directly set at load time:
+ if (progress > 1.0f || progress < 0.0f)
+ progress = 1.0f;
+
+ mProgress = mProgressToGo = progress;
+
setSize(width, height);
if (mInstances == 0)