summaryrefslogtreecommitdiff
path: root/src/localplayer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/localplayer.cpp')
-rw-r--r--src/localplayer.cpp29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 1cc0ae34..68b70db4 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -119,7 +119,12 @@ LocalPlayer::LocalPlayer(int id, int job, Map *map):
mUpdateName = true;
+ mTextColor = &guiPalette->getColor(Palette::PLAYER);
+ mNameColor = &guiPalette->getColor(Palette::SELF);
+
initTargetCursor();
+
+ config.addListener("showownname", this);
}
LocalPlayer::~LocalPlayer()
@@ -129,6 +134,8 @@ LocalPlayer::~LocalPlayer()
delete mStorage;
#endif
+ config.removeListener("showownname", this);
+
for (int i = Being::TC_SMALL; i < Being::NUM_TC; i++)
{
delete mTargetCursor[0][i];
@@ -258,20 +265,6 @@ void LocalPlayer::setGMLevel(int level)
setGM(true);
}
-void LocalPlayer::setName(const std::string &name)
-{
- if (mName)
- {
- delete mName;
- mName = 0;
- }
-
- if (config.getValue("showownname", false) && mMapInitialized)
- Player::setName(name);
- else
- Being::setName(name);
-}
-
void LocalPlayer::nextStep()
{
// TODO: Fix picking up when reaching target (this method is obsolete)
@@ -1113,3 +1106,11 @@ void LocalPlayer::addMessageToQueue(const std::string &message,
{
mMessages.push_back(MessagePair(message, color));
}
+
+void LocalPlayer::optionChanged(const std::string &value)
+{
+ if (value == "showownname")
+ {
+ setShowName(config.getValue("showownname", 1));
+ }
+}