summaryrefslogtreecommitdiff
path: root/src/localplayer.cpp
diff options
context:
space:
mode:
authorChuck Miller <shadowmil@gmail.com>2010-11-13 17:00:46 -0500
committerChuck Miller <shadowmil@gmail.com>2010-11-13 17:39:15 -0500
commitf8d22e47ac3b6392d68f1a8a45383798f5751101 (patch)
treee29b42821ec8f6e579f2cfd4d2a20bc8c248b930 /src/localplayer.cpp
parent8e7e63a2473eedd36eeef726e45dacc9d17d157a (diff)
downloadmana-client-f8d22e47ac3b6392d68f1a8a45383798f5751101.tar.gz
mana-client-f8d22e47ac3b6392d68f1a8a45383798f5751101.tar.bz2
mana-client-f8d22e47ac3b6392d68f1a8a45383798f5751101.tar.xz
mana-client-f8d22e47ac3b6392d68f1a8a45383798f5751101.zip
Replace config listeners with the event system
Reviewed-by: Jared Adams
Diffstat (limited to 'src/localplayer.cpp')
-rw-r--r--src/localplayer.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 79f814a3..4aec2399 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -91,15 +91,14 @@ LocalPlayer::LocalPlayer(int id, int subtype):
mUpdateName = true;
- config.addListener("showownname", this);
setShowName(config.getValue("showownname", 1));
+ listen(CHANNEL_CONFIG);
listen(CHANNEL_ACTORSPRITE);
}
LocalPlayer::~LocalPlayer()
{
- config.removeListener("showownname", this);
}
void LocalPlayer::logic()
@@ -1076,14 +1075,6 @@ void LocalPlayer::addMessageToQueue(const std::string &message, int color)
mMessages.push_back(MessagePair(message, color));
}
-void LocalPlayer::optionChanged(const std::string &value)
-{
- if (value == "showownname")
- {
- setShowName(config.getValue("showownname", 1));
- }
-}
-
void LocalPlayer::event(Channels channel, const Mana::Event &event)
{
if (channel == CHANNEL_ACTORSPRITE)
@@ -1112,6 +1103,15 @@ void LocalPlayer::event(Channels channel, const Mana::Event &event)
}
}
}
+ else if (channel == CHANNEL_CONFIG)
+ {
+ if (event.getName() == EVENT_CONFIGOPTIONCHANGED &&
+ event.getString("option") == "showownname")
+ {
+ setShowName(config.getValue("showownname", 1));
+ }
+
+ }
Being::event(channel, event);
}