From 4af8049ec716a4bbce46f08cb6df8d6fef8c2970 Mon Sep 17 00:00:00 2001 From: Tametomo Date: Sun, 3 May 2009 09:49:42 -0600 Subject: Made the experience bar have a fixed, two digit precision past the decimal point, as well as simplifying the logic to calculate it. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tametomo Signed-off-by: Bjørn Lindeijer (adapted patch) --- src/gui/status.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/gui/status.cpp') diff --git a/src/gui/status.cpp b/src/gui/status.cpp index 643f5330..d6057b13 100644 --- a/src/gui/status.cpp +++ b/src/gui/status.cpp @@ -386,8 +386,7 @@ void StatusWindow::updateXPBar(ProgressBar *bar, bool percent) { float xp = (float) player_node->getXp() / player_node->mXpForNextLevel; - bar->setText(toString((float) ((int) (xp * 10000.0f)) / 100.0f) + - "%"); + bar->setText(strprintf("%2.2f", 100 * xp) + "%"); } else bar->setText(toString(player_node->getXp()) + @@ -408,14 +407,13 @@ void StatusWindow::updateJobBar(ProgressBar *bar, bool percent) { float xp = (float) player_node->mJobXp / player_node->mJobXpForNextLevel; - bar->setText(toString((float) ((int) (xp * 10000.0f)) / 100.0f) + - "%"); + bar->setText(strprintf("%2.2f", 100 * xp) + "%"); } else bar->setText(toString(player_node->mJobXp) + "/" + toString(player_node->mJobXpForNextLevel)); bar->setProgress((float) player_node->mJobXp / - (float) player_node->mJobXpForNextLevel); + (float) player_node->mJobXpForNextLevel); } } -- cgit v1.2.3-70-g09d2