diff options
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); } |