diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-04-27 14:50:47 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-04-27 14:50:47 +0300 |
commit | 744b6e62e1252ca50445b21f671ad8d81dd28ea1 (patch) | |
tree | 79adc9663a740ed471e33c97932ce6b28de11377 /src/gui/windows/ministatuswindow.cpp | |
parent | 2ee2f8b060e4fe88feeeba5508189c916e55a70d (diff) | |
download | mv-744b6e62e1252ca50445b21f671ad8d81dd28ea1.tar.gz mv-744b6e62e1252ca50445b21f671ad8d81dd28ea1.tar.bz2 mv-744b6e62e1252ca50445b21f671ad8d81dd28ea1.tar.xz mv-744b6e62e1252ca50445b21f671ad8d81dd28ea1.zip |
Add AttributeListener.
Diffstat (limited to 'src/gui/windows/ministatuswindow.cpp')
-rw-r--r-- | src/gui/windows/ministatuswindow.cpp | 52 |
1 files changed, 29 insertions, 23 deletions
diff --git a/src/gui/windows/ministatuswindow.cpp b/src/gui/windows/ministatuswindow.cpp index 93a6a6a10..6fb330bbf 100644 --- a/src/gui/windows/ministatuswindow.cpp +++ b/src/gui/windows/ministatuswindow.cpp @@ -55,6 +55,7 @@ typedef std::vector <ProgressBar*>::const_iterator ProgressBarVectorCIter; MiniStatusWindow::MiniStatusWindow() : Window("MiniStatus", false, nullptr, "ministatus.xml"), InventoryListener(), + AttributeListener(), mBars(), mBarNames(), mIcons(), @@ -253,35 +254,40 @@ void MiniStatusWindow::drawIcons(Graphics *const graphics) void MiniStatusWindow::processEvent(const Channels channel A_UNUSED, const DepricatedEvent &event) { - if (event.getName() == EVENT_UPDATEATTRIBUTE) + if (event.getName() == EVENT_UPDATESTAT) { - const int id = event.getInt("id"); - if (id == PlayerInfo::HP || id == PlayerInfo::MAX_HP) - { + statusWindow->updateMPBar(mMpBar); + StatusWindow::updateJobBar(mJobBar); + } +} + +void MiniStatusWindow::attributeChanged(const int id, + const int oldVal A_UNUSED, + const int newVal A_UNUSED) +{ + switch (id) + { + case PlayerInfo::HP: + case PlayerInfo::MAX_HP: StatusWindow::updateHPBar(mHpBar); - } - else if (id == PlayerInfo::MP || id == PlayerInfo::MAX_MP) - { + break; + case PlayerInfo::MP: + case PlayerInfo::MAX_MP: statusWindow->updateMPBar(mMpBar); - } - else if (id == PlayerInfo::EXP || id == PlayerInfo::EXP_NEEDED) - { + break; + case PlayerInfo::EXP: + case PlayerInfo::EXP_NEEDED: StatusWindow::updateXPBar(mXpBar); - } - else if (id == PlayerInfo::TOTAL_WEIGHT - || id == PlayerInfo::MAX_WEIGHT) - { + break; + case PlayerInfo::TOTAL_WEIGHT: + case PlayerInfo::MAX_WEIGHT: StatusWindow::updateWeightBar(mWeightBar); - } - else if (id == PlayerInfo::MONEY) - { + break; + case PlayerInfo::MONEY: StatusWindow::updateMoneyBar(mMoneyBar); - } - } - else if (event.getName() == EVENT_UPDATESTAT) - { - statusWindow->updateMPBar(mMpBar); - StatusWindow::updateJobBar(mJobBar); + break; + default: + break; } } |