diff options
author | Chuck Miller <shadowmil@gmail.com> | 2010-11-13 17:00:46 -0500 |
---|---|---|
committer | Chuck Miller <shadowmil@gmail.com> | 2010-11-13 17:39:15 -0500 |
commit | f8d22e47ac3b6392d68f1a8a45383798f5751101 (patch) | |
tree | e29b42821ec8f6e579f2cfd4d2a20bc8c248b930 /src/localplayer.cpp | |
parent | 8e7e63a2473eedd36eeef726e45dacc9d17d157a (diff) | |
download | mana-f8d22e47ac3b6392d68f1a8a45383798f5751101.tar.gz mana-f8d22e47ac3b6392d68f1a8a45383798f5751101.tar.bz2 mana-f8d22e47ac3b6392d68f1a8a45383798f5751101.tar.xz mana-f8d22e47ac3b6392d68f1a8a45383798f5751101.zip |
Replace config listeners with the event system
Reviewed-by: Jared Adams
Diffstat (limited to 'src/localplayer.cpp')
-rw-r--r-- | src/localplayer.cpp | 20 |
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); } |