From 2c93d5449517c1e1d62d813034a0c1406867aa7d Mon Sep 17 00:00:00 2001 From: Bertram Date: Sat, 25 Jul 2009 01:27:31 +0200 Subject: Fixed the XP bars strange behaviour. By wrapping a bit more the values given at load time. --- src/gui/widgets/progressbar.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') 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) -- cgit v1.2.3-70-g09d2