summaryrefslogtreecommitdiff
path: root/src/being.cpp
diff options
context:
space:
mode:
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"));
+ }
+ }
+
}