diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-05-22 22:21:21 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-05-22 23:03:48 +0300 |
commit | 6494df1ca2a1c00b85828deb3b62f371338536fb (patch) | |
tree | f4b7e6593ee9b6affa6516d6b0fdbbf7051c6dba | |
parent | 7f06820c754522b00d1a3954036931a0b6efcf0f (diff) | |
download | mv-6494df1ca2a1c00b85828deb3b62f371338536fb.tar.gz mv-6494df1ca2a1c00b85828deb3b62f371338536fb.tar.bz2 mv-6494df1ca2a1c00b85828deb3b62f371338536fb.tar.xz mv-6494df1ca2a1c00b85828deb3b62f371338536fb.zip |
Add option to hide nick for erased players relation.
-rw-r--r-- | src/being.cpp | 17 | ||||
-rw-r--r-- | src/being.h | 1 | ||||
-rw-r--r-- | src/defaults.cpp | 1 | ||||
-rw-r--r-- | src/gui/popupmenu.cpp | 4 | ||||
-rw-r--r-- | src/gui/setup_players.cpp | 3 |
5 files changed, 20 insertions, 6 deletions
diff --git a/src/being.cpp b/src/being.cpp index 69dfb9046..c58cc4696 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -203,6 +203,7 @@ bool Being::mShowGender = false; bool Being::mShowLevel = false; bool Being::mShowPlayersStatus = false; bool Being::mEnableReorderSprites = true; +bool Being::mHideErased = false; std::list<BeingCacheEntry*> beingInfoCache; @@ -279,7 +280,7 @@ Being::Being(int id, Type type, Uint16 subtype, Map *map): config.addListener("visiblenames", this); - mEnableReorderSprites = config.getBoolValue("enableReorderSprites"); + reReadConfig(); if (mType == NPC) setShowName(true); @@ -1602,8 +1603,18 @@ std::string Being::getGenderSign() const void Being::showName() { + if (mName.empty()) + return; + delete mDispName; mDispName = nullptr; + + if (mHideErased && player_relations.getRelation(mName) == + PlayerRelation::ERASED) + { + return; + } + std::string mDisplayName(mName); if (mType != MONSTER && (mShowGender || mShowLevel)) @@ -1632,9 +1643,6 @@ void Being::showName() font = gui->getSecureFont(); } - if (mDisplayName.empty()) - return; - mDispName = new FlashText(mDisplayName, getPixelX(), getPixelY(), gcn::Graphics::CENTER, mNameColor, font); @@ -1837,6 +1845,7 @@ void Being::reReadConfig() mShowLevel = config.getBoolValue("showlevel"); mShowPlayersStatus = config.getBoolValue("showPlayersStatus"); mEnableReorderSprites = config.getBoolValue("enableReorderSprites"); + mHideErased = config.getBoolValue("hideErased"); mUpdateConfigTime = cur_time; } diff --git a/src/being.h b/src/being.h index 250073faa..ee4efef0f 100644 --- a/src/being.h +++ b/src/being.h @@ -905,6 +905,7 @@ class Being : public ActorSprite, public ConfigListener static bool mShowLevel; static bool mShowPlayersStatus; static bool mEnableReorderSprites; + static bool mHideErased; unsigned int mMoveTime; unsigned int mAttackTime; diff --git a/src/defaults.cpp b/src/defaults.cpp index 264914ba4..e8f421216 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -258,6 +258,7 @@ DefaultsData* getConfigDefaults() AddDEF(configData, "networksleep", 0); AddDEF(configData, "newtextures", true); AddDEF(configData, "videodetected", false); + AddDEF(configData, "hideErased", false); return configData; } diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index 436fd93b1..318de81b0 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -730,8 +730,7 @@ void PopupMenu::handleLink(const std::string &link, } else if (link == "unignore" && !mNick.empty()) { - player_relations.setRelation(mNick, - PlayerRelation::NEUTRAL); + player_relations.setRelation(mNick, PlayerRelation::NEUTRAL); } else if (link == "ignore" && being && being->getType() == ActorSprite::PLAYER) @@ -768,6 +767,7 @@ void PopupMenu::handleLink(const std::string &link, being->getType() == ActorSprite::PLAYER) { player_relations.setRelation(being->getName(), PlayerRelation::ERASED); + being->updateName(); } else if (link == "erase" && !mNick.empty()) { diff --git a/src/gui/setup_players.cpp b/src/gui/setup_players.cpp index b2cd7847d..0f5fb9615 100644 --- a/src/gui/setup_players.cpp +++ b/src/gui/setup_players.cpp @@ -86,6 +86,9 @@ Setup_Players::Setup_Players() new SetupItemCheckBox(_("Group friends in who is online window"), "", "groupFriends", this, "groupFriendsEvent"); + new SetupItemCheckBox(_("Hide erased players nicks"), "", + "hideErased", this, "hideErasedEvent"); + setDimension(gcn::Rectangle(0, 0, 550, 350)); } |