diff options
author | Bertram <bertram@cegetel.net> | 2009-07-24 23:37:39 +0200 |
---|---|---|
committer | Bertram <bertram@cegetel.net> | 2009-07-24 23:37:39 +0200 |
commit | ffa576ef95433aed5e6ba82e593a52750827d9b7 (patch) | |
tree | 7c562d15ef05e0415164d087775bb48b477dd890 /src/gui/statuswindow.cpp | |
parent | 8195e73cb801d56240beb966554a864729d9f20c (diff) | |
download | mana-ffa576ef95433aed5e6ba82e593a52750827d9b7.tar.gz mana-ffa576ef95433aed5e6ba82e593a52750827d9b7.tar.bz2 mana-ffa576ef95433aed5e6ba82e593a52750827d9b7.tar.xz mana-ffa576ef95433aed5e6ba82e593a52750827d9b7.zip |
Fixed tmw start not crash at startup.
The update of ministatus window was broken because the implementation makes StatusWindow tries
to access private members of ministatus...
Diffstat (limited to 'src/gui/statuswindow.cpp')
-rw-r--r-- | src/gui/statuswindow.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp index 5d4ad8c4..bd1d4d85 100644 --- a/src/gui/statuswindow.cpp +++ b/src/gui/statuswindow.cpp @@ -183,24 +183,18 @@ std::string StatusWindow::update(int id) { updateHPBar(mHpBar, true); - miniStatusWindow->update(HP); - return _("HP"); } else if (id == MP) { updateMPBar(mMpBar, true); - miniStatusWindow->update(MP); - return _("MP"); } else if (id == EXP) { updateXPBar(mXpBar, false); - miniStatusWindow->update(EXP); - return _("Exp"); } else if (id == MONEY) @@ -293,6 +287,7 @@ void StatusWindow::addAttribute(int id, const std::string &name, void StatusWindow::updateHPBar(ProgressBar *bar, bool showMax) { + if (showMax) bar->setText(toString(player_node->getHp()) + "/" + toString(player_node->getMaxHp())); @@ -313,6 +308,7 @@ void StatusWindow::updateHPBar(ProgressBar *bar, bool showMax) int curHP = player_node->getHp(); int thresholdLevel = player_node->getMaxHp() / 4; int thresholdProgress = curHP % thresholdLevel; + if (thresholdLevel) weight = 1 - ((float)thresholdProgress) / ((float)thresholdLevel); else @@ -368,6 +364,7 @@ void StatusWindow::updateHPBar(ProgressBar *bar, bool showMax) bar->setColor(r1, g1, b1); bar->setProgress((float) player_node->getHp() / (float) player_node->getMaxHp()); + } void StatusWindow::updateMPBar(ProgressBar *bar, bool showMax) |