diff options
author | Tametomo <irarice@gmail.com> | 2009-05-03 09:49:42 -0600 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-05-04 23:07:11 +0200 |
commit | 4af8049ec716a4bbce46f08cb6df8d6fef8c2970 (patch) | |
tree | 784e72e8d709e4e5fc2611b6ce165071283636d5 /src | |
parent | bff1991e15c47bfc9f96435bb072686565bcd602 (diff) | |
download | mana-4af8049ec716a4bbce46f08cb6df8d6fef8c2970.tar.gz mana-4af8049ec716a4bbce46f08cb6df8d6fef8c2970.tar.bz2 mana-4af8049ec716a4bbce46f08cb6df8d6fef8c2970.tar.xz mana-4af8049ec716a4bbce46f08cb6df8d6fef8c2970.zip |
Made the experience bar have a fixed, two digit precision past the
decimal point, as well as simplifying the logic to calculate it.
Signed-off-by: Tametomo <irarice@gmail.com>
Signed-off-by: Bjørn Lindeijer <bjorn@lindeijer.nl>
(adapted patch)
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/status.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
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); } } |