summaryrefslogtreecommitdiff
path: root/src/gui/ministatus.cpp
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_fr>2010-06-01 01:20:56 +0200
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_fr>2010-06-01 01:31:32 +0200
commit64776c1b4c6ccdd3e46897a59c201dd749de9dff (patch)
tree45ea4c97b4acc9d1dd9819408659aa1e5a3a336b /src/gui/ministatus.cpp
parent34e7725106500af8f4ed4f148e60005b9738c04a (diff)
downloadmana-64776c1b4c6ccdd3e46897a59c201dd749de9dff.tar.gz
mana-64776c1b4c6ccdd3e46897a59c201dd749de9dff.tar.bz2
mana-64776c1b4c6ccdd3e46897a59c201dd749de9dff.tar.xz
mana-64776c1b4c6ccdd3e46897a59c201dd749de9dff.zip
Made the MP bar be shown only if the protocol is using it.
Reviewed-by: Jaxad0127.
Diffstat (limited to 'src/gui/ministatus.cpp')
-rw-r--r--src/gui/ministatus.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/gui/ministatus.cpp b/src/gui/ministatus.cpp
index 90581f61..c8c942fd 100644
--- a/src/gui/ministatus.cpp
+++ b/src/gui/ministatus.cpp
@@ -35,6 +35,7 @@
#include "net/net.h"
#include "net/playerhandler.h"
+#include "net/gamehandler.h"
#include "utils/gettext.h"
#include "utils/stringutils.h"
@@ -47,19 +48,28 @@ MiniStatusWindow::MiniStatusWindow():
int max = player_node->getMaxHp();
mHpBar = new ProgressBar(max ? (float) player_node->getHp() / max : 0,
100, 20, Theme::PROG_HP);
- max = player_node->getMaxMP();
- mMpBar = new ProgressBar(max ? (float) player_node->getMP() / max : 0,
+ if (Net::getGameHandler()->canUseMagicBar())
+ {
+ max = player_node->getMaxMP();
+ mMpBar = new ProgressBar(max ? (float) player_node->getMaxMP() / max : 0,
100, 20, Net::getPlayerHandler()->canUseMagic() ?
Theme::PROG_MP : Theme::PROG_NO_MP);
+ }
+ else
+ mMpBar = 0;
+
max = player_node->getExpNeeded();
mXpBar = new ProgressBar(max ? (float) player_node->getExp() / max : 0,
100, 20, Theme::PROG_EXP);
mHpBar->setPosition(0, 3);
- mMpBar->setPosition(mHpBar->getWidth() + 3, 3);
- mXpBar->setPosition(mMpBar->getX() + mMpBar->getWidth() + 3, 3);
+ if (mMpBar)
+ mMpBar->setPosition(mHpBar->getWidth() + 3, 3);
+ mXpBar->setPosition(mMpBar ? mMpBar->getX() + mMpBar->getWidth() + 3 :
+ mHpBar->getX() + mHpBar->getWidth() + 3, 3);
add(mHpBar);
- add(mMpBar);
+ if (mMpBar)
+ add(mMpBar);
add(mXpBar);
setContentSize(mXpBar->getX() + mXpBar->getWidth(),