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/being.cpp | |
parent | 8e7e63a2473eedd36eeef726e45dacc9d17d157a (diff) | |
download | mana-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/being.cpp')
-rw-r--r-- | src/being.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/being.cpp b/src/being.cpp index 47410620..d0442610 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -110,19 +110,16 @@ Being::Being(int id, Type type, int subtype, Map *map): if (getType() == PLAYER) mShowName = config.getBoolValue("visiblenames"); - config.addListener("visiblenames", this); - if (getType() == PLAYER || getType() == NPC) setShowName(true); updateColors(); + listen(CHANNEL_CONFIG); listen(CHANNEL_CHAT); } Being::~Being() { - config.removeListener("visiblenames", this); - delete mSpeechBubble; delete mDispName; delete mText; @@ -991,14 +988,6 @@ void Being::updateCoords() mDispName->adviseXY(getPixelX(), getPixelY()); } -void Being::optionChanged(const std::string &value) -{ - if (getType() == PLAYER && value == "visiblenames") - { - setShowName(config.getBoolValue("visiblenames")); - } -} - void Being::flashName(int time) { if (mDispName) @@ -1228,4 +1217,13 @@ void Being::event(Channels channel, const Mana::Event &event) catch (Mana::BadEvent badEvent) {} } + else if (channel == CHANNEL_CONFIG && + event.getName() == EVENT_CONFIGOPTIONCHANGED) + { + if (getType() == PLAYER && event.getString("option") == "visiblenames") + { + setShowName(config.getBoolValue("visiblenames")); + } + } + } |