diff options
author | Jared Adams <jaxad0127@gmail.com> | 2010-03-25 08:46:21 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2010-03-25 10:10:42 -0600 |
commit | 83077364f8b67fb9fc57e8b04a1feff0e243848d (patch) | |
tree | 2ac3917c8c1451d5f0f3cd45e5b4ec5a225f4977 /src | |
parent | fa058a891352ab4f85bafbf4e819c013ddfe4df7 (diff) | |
download | mana-83077364f8b67fb9fc57e8b04a1feff0e243848d.tar.gz mana-83077364f8b67fb9fc57e8b04a1feff0e243848d.tar.bz2 mana-83077364f8b67fb9fc57e8b04a1feff0e243848d.tar.xz mana-83077364f8b67fb9fc57e8b04a1feff0e243848d.zip |
Fix some ProgressBar issues in StatusWindow
When max was 0, it was causing problems.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/statuswindow.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp index e5d59624..7312078e 100644 --- a/src/gui/statuswindow.cpp +++ b/src/gui/statuswindow.cpp @@ -303,7 +303,10 @@ void StatusWindow::updateHPBar(ProgressBar *bar, bool showMax) else bar->setText(toString(player_node->getHp())); - float prog = (float) player_node->getHp() / player_node->getMaxHp(); + float prog = 1.0; + + if (player_node->getMaxHp() > 0) + prog = (float) player_node->getHp() / player_node->getMaxHp(); bar->setProgress(prog); } @@ -315,7 +318,10 @@ void StatusWindow::updateMPBar(ProgressBar *bar, bool showMax) else bar->setText(toString(player_node->getMP())); - float prog = (float) player_node->getMP() / player_node->getMaxMP(); + float prog = 1.0f; + + if (player_node->getMaxMP() > 0) + prog = (float) player_node->getMP() / player_node->getMaxMP(); if (Net::getPlayerHandler()->canUseMagic()) bar->setProgressPalette(Theme::PROG_MP); |