diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-03-31 14:18:08 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-03-31 14:18:08 +0300 |
commit | 8f52bfee633b4aa2f7e49c1e16428d8f1c03fcfc (patch) | |
tree | a085aa87be20d1355f1aceaead205d6005b513e0 | |
parent | b637ace3685fb35e7de7c4e7cdae0638c80cd45a (diff) | |
download | manaplus-8f52bfee633b4aa2f7e49c1e16428d8f1c03fcfc.tar.gz manaplus-8f52bfee633b4aa2f7e49c1e16428d8f1c03fcfc.tar.bz2 manaplus-8f52bfee633b4aa2f7e49c1e16428d8f1c03fcfc.tar.xz manaplus-8f52bfee633b4aa2f7e49c1e16428d8f1c03fcfc.zip |
Add option to move player names (disabled by default).
In old implimentation names was always moved.
-rw-r--r-- | src/being.cpp | 8 | ||||
-rw-r--r-- | src/being.h | 1 | ||||
-rw-r--r-- | src/defaults.cpp | 1 | ||||
-rw-r--r-- | src/gui/setup_players.cpp | 3 | ||||
-rw-r--r-- | src/text.cpp | 11 | ||||
-rw-r--r-- | src/text.h | 2 |
6 files changed, 20 insertions, 6 deletions
diff --git a/src/being.cpp b/src/being.cpp index 22ce33f41..feb0cfbbc 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -189,6 +189,7 @@ bool Being::mShowLevel = false; bool Being::mShowPlayersStatus = false; bool Being::mEnableReorderSprites = true; bool Being::mHideErased = false; +bool Being::mMoveNames = false; int Being::mAwayEffect = -1; std::list<BeingCacheEntry*> beingInfoCache; @@ -362,7 +363,7 @@ void Being::setPosition(const Vector &pos) if (mText) { mText->adviseXY(static_cast<int>(pos.x), static_cast<int>(pos.y) - - getHeight() - mText->getHeight() - 6); + - getHeight() - mText->getHeight() - 6, mMoveNames); } } @@ -1587,11 +1588,11 @@ void Being::updateCoords() if (mType == MONSTER) { mDispName->adviseXY(getPixelX(), - getPixelY() - getHeight() - mDispName->getHeight()); + getPixelY() - getHeight() - mDispName->getHeight(), mMoveNames); } else { - mDispName->adviseXY(getPixelX(), getPixelY()); + mDispName->adviseXY(getPixelX(), getPixelY(), mMoveNames); } } @@ -1927,6 +1928,7 @@ void Being::reReadConfig() mShowPlayersStatus = config.getBoolValue("showPlayersStatus"); mEnableReorderSprites = config.getBoolValue("enableReorderSprites"); mHideErased = config.getBoolValue("hideErased"); + mMoveNames = config.getBoolValue("moveNames"); mUpdateConfigTime = cur_time; } diff --git a/src/being.h b/src/being.h index f41df41eb..2757ea06c 100644 --- a/src/being.h +++ b/src/being.h @@ -999,6 +999,7 @@ class Being : public ActorSprite, public ConfigListener static bool mShowPlayersStatus; static bool mEnableReorderSprites; static bool mHideErased; + static bool mMoveNames; static int mAwayEffect; unsigned int mMoveTime; diff --git a/src/defaults.cpp b/src/defaults.cpp index 5a51fa639..96f22dba7 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -313,6 +313,7 @@ DefaultsData* getConfigDefaults() AddDEF("weightMsg", true); AddDEF("enableLangTab", true); AddDEF("showAllLang", false); + AddDEF("moveNames", false); return configData; } diff --git a/src/gui/setup_players.cpp b/src/gui/setup_players.cpp index cf2a33378..92e856897 100644 --- a/src/gui/setup_players.cpp +++ b/src/gui/setup_players.cpp @@ -68,6 +68,9 @@ Setup_Players::Setup_Players(const Widget2 *const widget) : new SetupItemCheckBox(_("Visible names"), "", "visiblenames", this, "visiblenamesEvent"); + new SetupItemCheckBox(_("Auto move names"), "", + "moveNames", this, "moveNamesEvent"); + new SetupItemCheckBox(_("Secure trades"), "", "securetrades", this, "securetradesEvent"); diff --git a/src/text.cpp b/src/text.cpp index 76271aecb..07041afd9 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -118,10 +118,17 @@ void Text::setColor(const gcn::Color *const color) mColor = color; } -void Text::adviseXY(const int x, const int y) +void Text::adviseXY(const int x, const int y, const bool move) { - if (textManager) + if (textManager && move) + { textManager->moveText(this, x - mXOffset, y); + } + else + { + mX = x - mXOffset; + mY = y; + } } void Text::draw(Graphics *const graphics, const int xOff, const int yOff) diff --git a/src/text.h b/src/text.h index ff9b4145b..b0ea29c03 100644 --- a/src/text.h +++ b/src/text.h @@ -62,7 +62,7 @@ class Text /** * Allows the originator of the text to specify the ideal coordinates. */ - void adviseXY(const int x, const int y); + void adviseXY(const int x, const int y, const bool move); /** * Draws the text. |