summaryrefslogtreecommitdiff
path: root/src/gui/windows/killstats.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-04-27 14:50:47 +0300
committerAndrei Karas <akaras@inbox.ru>2014-04-27 14:50:47 +0300
commit744b6e62e1252ca50445b21f671ad8d81dd28ea1 (patch)
tree79adc9663a740ed471e33c97932ce6b28de11377 /src/gui/windows/killstats.cpp
parent2ee2f8b060e4fe88feeeba5508189c916e55a70d (diff)
downloadmv-744b6e62e1252ca50445b21f671ad8d81dd28ea1.tar.gz
mv-744b6e62e1252ca50445b21f671ad8d81dd28ea1.tar.bz2
mv-744b6e62e1252ca50445b21f671ad8d81dd28ea1.tar.xz
mv-744b6e62e1252ca50445b21f671ad8d81dd28ea1.zip
Add AttributeListener.
Diffstat (limited to 'src/gui/windows/killstats.cpp')
-rw-r--r--src/gui/windows/killstats.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/gui/windows/killstats.cpp b/src/gui/windows/killstats.cpp
index 467d27524..832892fac 100644
--- a/src/gui/windows/killstats.cpp
+++ b/src/gui/windows/killstats.cpp
@@ -41,6 +41,7 @@ KillStats::KillStats() :
// TRANSLATORS: kill stats window name
Window(_("Kill stats"), false, nullptr, "killstats.xml"),
ActionListener(),
+ AttributeListener(),
mKillTimer(0),
// TRANSLATORS: kill stats window button
mResetButton(new Button(this, _("Reset stats"), "reset", this)),
@@ -108,7 +109,6 @@ KillStats::KillStats() :
setStickyButtonLock(true);
setDefaultSize(250, 250, 350, 300);
- listen(CHANNEL_ATTRIBUTES);
const int xp(PlayerInfo::getAttribute(PlayerInfo::EXP));
int xpNextLevel(PlayerInfo::getAttribute(PlayerInfo::EXP_NEEDED));
@@ -489,18 +489,17 @@ void KillStats::validateJacko()
}
}
-void KillStats::processEvent(const Channels channel A_UNUSED,
- const DepricatedEvent &event)
+void KillStats::attributeChanged(const int id,
+ const int oldVal,
+ const int newVal)
{
- if (event.getName() == EVENT_UPDATEATTRIBUTE)
+ switch (id)
{
- const int id = event.getInt("id");
- if (id == PlayerInfo::EXP || id == PlayerInfo::EXP_NEEDED)
- {
- gainXp(event.getInt("newValue") - event.getInt("oldValue"));
- }
- else if (id == PlayerInfo::LEVEL)
- {
+ case PlayerInfo::EXP:
+ case PlayerInfo::EXP_NEEDED:
+ gainXp(newVal - oldVal);
+ break;
+ case PlayerInfo::LEVEL:
mKillCounter = 0;
mKillTCounter = 0;
mExpCounter = 0;
@@ -520,6 +519,8 @@ void KillStats::processEvent(const Channels channel A_UNUSED,
_("Kills/Min: %s, Exp/Min: %s"), "?", "?"));
resetTimes();
- }
+ break;
+ default:
+ break;
}
}