diff options
Diffstat (limited to 'src/gui/windows')
-rw-r--r-- | src/gui/windows/ministatuswindow.cpp | 7 | ||||
-rw-r--r-- | src/gui/windows/statuswindow.cpp | 63 |
2 files changed, 28 insertions, 42 deletions
diff --git a/src/gui/windows/ministatuswindow.cpp b/src/gui/windows/ministatuswindow.cpp index 6098f59cf..09754420f 100644 --- a/src/gui/windows/ministatuswindow.cpp +++ b/src/gui/windows/ministatuswindow.cpp @@ -69,8 +69,7 @@ MiniStatusWindow::MiniStatusWindow() : mHpBar(createBar(0, 100, 0, ThemeColorId::HP_BAR, ProgressColorId::PROG_HP, "hpprogressbar.xml", "hpprogressbar_fill.xml", "hp bar", _("health bar"))), - mMpBar(gameHandler->canUseMagicBar() - ? createBar(0, 100, 0, playerHandler->canUseMagic() + mMpBar(createBar(0, 100, 0, playerHandler->canUseMagic() ? ThemeColorId::MP_BAR : ThemeColorId::NO_MP_BAR, playerHandler->canUseMagic() ? ProgressColorId::PROG_MP : ProgressColorId::PROG_NO_MP, @@ -79,7 +78,7 @@ MiniStatusWindow::MiniStatusWindow() : playerHandler->canUseMagic() ? "mpprogressbar_fill.xml" : "nompprogressbar_fill.xml", // TRANSLATORS: status bar name - "mp bar", _("mana bar")) : nullptr), + "mp bar", _("mana bar"))), mXpBar(createBar(0, 100, 0, ThemeColorId::XP_BAR, ProgressColorId::PROG_EXP, "xpprogressbar.xml", "xpprogressbar_fill.xml", // TRANSLATORS: status bar name @@ -120,7 +119,7 @@ MiniStatusWindow::MiniStatusWindow() : { StatusWindow::updateHPBar(mHpBar); - if (gameHandler->canUseMagicBar() && statusWindow) + if (statusWindow) statusWindow->updateMPBar(mMpBar); const bool job = serverConfig.getValueBool("showJob", true); diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp index 53240a0c7..7a2a2c206 100644 --- a/src/gui/windows/statuswindow.cpp +++ b/src/gui/windows/statuswindow.cpp @@ -128,39 +128,30 @@ StatusWindow::StatusWindow() : mXpBar->setColor(getThemeColor(ThemeColorId::XP_BAR), getThemeColor(ThemeColorId::XP_BAR_OUTLINE)); - const bool magicBar = gameHandler->canUseMagicBar(); const bool job = serverConfig.getValueBool("showJob", true); - if (magicBar) + max = PlayerInfo::getAttribute(Attributes::MAX_MP); + // TRANSLATORS: status window label + mMpLabel = new Label(this, _("MP:")); + const bool useMagic = playerHandler->canUseMagic(); + mMpBar = new ProgressBar(this, + max ? static_cast<float>(PlayerInfo::getAttribute( + Attributes::MAX_MP)) / static_cast<float>(max) + : static_cast<float>(0), + 80, + 0, + useMagic ? ProgressColorId::PROG_MP : ProgressColorId::PROG_NO_MP, + useMagic ? "mpprogressbar.xml" : "nompprogressbar.xml", + useMagic ? "mpprogressbar_fill.xml" : "nompprogressbar_fill.xml"); + if (useMagic) { - max = PlayerInfo::getAttribute(Attributes::MAX_MP); - // TRANSLATORS: status window label - mMpLabel = new Label(this, _("MP:")); - const bool useMagic = playerHandler->canUseMagic(); - mMpBar = new ProgressBar(this, - max ? static_cast<float>(PlayerInfo::getAttribute( - Attributes::MAX_MP)) / static_cast<float>(max) - : static_cast<float>(0), - 80, - 0, - useMagic ? ProgressColorId::PROG_MP : ProgressColorId::PROG_NO_MP, - useMagic ? "mpprogressbar.xml" : "nompprogressbar.xml", - useMagic ? "mpprogressbar_fill.xml" : "nompprogressbar_fill.xml"); - if (useMagic) - { - mMpBar->setColor(getThemeColor(ThemeColorId::MP_BAR), - getThemeColor(ThemeColorId::MP_BAR_OUTLINE)); - } - else - { - mMpBar->setColor(getThemeColor(ThemeColorId::NO_MP_BAR), - getThemeColor(ThemeColorId::NO_MP_BAR_OUTLINE)); - } + mMpBar->setColor(getThemeColor(ThemeColorId::MP_BAR), + getThemeColor(ThemeColorId::MP_BAR_OUTLINE)); } else { - mMpLabel = nullptr; - mMpBar = nullptr; + mMpBar->setColor(getThemeColor(ThemeColorId::NO_MP_BAR), + getThemeColor(ThemeColorId::NO_MP_BAR_OUTLINE)); } place(0, 0, mLvlLabel, 3); @@ -168,15 +159,12 @@ StatusWindow::StatusWindow() : place(1, 1, mHpBar, 4); place(5, 1, mXpLabel).setPadding(3); place(6, 1, mXpBar, 5); - if (magicBar) - { - place(0, 2, mMpLabel).setPadding(3); - // 5, 2 and 6, 2 Job Progress Bar - if (job) - place(1, 2, mMpBar, 4); - else - place(1, 2, mMpBar, 10); - } + place(0, 2, mMpLabel).setPadding(3); + // 5, 2 and 6, 2 Job Progress Bar + if (job) + place(1, 2, mMpBar, 4); + else + place(1, 2, mMpBar, 10); if (job) { @@ -224,8 +212,7 @@ StatusWindow::StatusWindow() : // Update bars updateHPBar(mHpBar, true); - if (magicBar) - updateMPBar(mMpBar, true); + updateMPBar(mMpBar, true); updateXPBar(mXpBar, false); // TRANSLATORS: status window label |