summaryrefslogtreecommitdiff
path: root/src/being.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/being.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/being.cpp')
-rw-r--r--src/being.cpp22
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"));
+ }
+ }
+
}