diff options
author | Andrei Karas <akaras@inbox.ru> | 2018-02-13 05:24:46 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2018-02-13 05:24:46 +0300 |
commit | 869cb1c660310140f02a0b3804e02a2f3c4a0326 (patch) | |
tree | 2f0df222ebf1292d17aba1f8b0fe66866a18b330 /src/being/being.cpp | |
parent | 3a4d8f947b0358c636f983b4248777e8371678dd (diff) | |
download | mv-869cb1c660310140f02a0b3804e02a2f3c4a0326.tar.gz mv-869cb1c660310140f02a0b3804e02a2f3c4a0326.tar.bz2 mv-869cb1c660310140f02a0b3804e02a2f3c4a0326.tar.xz mv-869cb1c660310140f02a0b3804e02a2f3c4a0326.zip |
Add support for show clan badge.
But for now clan unset for players.
Diffstat (limited to 'src/being/being.cpp')
-rw-r--r-- | src/being/being.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp index da67becda..bb921f92f 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -173,6 +173,7 @@ Being::Being(const BeingId id, mRaceName(), mPartyName(), mGuildName(), + mClanName(), mSpeech(), mDispName(nullptr), mNameColor(nullptr), @@ -1201,6 +1202,33 @@ void Being::setGuildName(const std::string &restrict name) restrict2 } } +void Being::showClanBadge(const bool show) restrict2 +{ + delete2(mBadges[BadgeIndex::Clan]); + if (show && + !mClanName.empty() && + mShowBadges != BadgeDrawType::Hide) + { + const std::string badge = BadgesDB::getClanBadge(mClanName); + if (!badge.empty()) + { + mBadges[BadgeIndex::Clan] = AnimatedSprite::load( + paths.getStringValue("badges") + badge, + 0); + } + } +} + +void Being::setClanName(const std::string &restrict name) restrict2 +{ + if (mClanName != name) + { + mClanName = name; + showClanBadge(!mClanName.empty()); + updateBadgesCount(); + } +} + void Being::setGuildPos(const std::string &restrict pos A_UNUSED) restrict2 { } |