diff options
Diffstat (limited to 'src/being')
-rw-r--r-- | src/being/being.cpp | 28 | ||||
-rw-r--r-- | src/being/being.h | 9 |
2 files changed, 37 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 { } diff --git a/src/being/being.h b/src/being/being.h index 4e672ef52..fe8bb4c6a 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -259,6 +259,10 @@ class Being notfinal : public ActorSprite, A_WARN_UNUSED { return mGuildName; } + const std::string &getClanName() const restrict2 noexcept2 + A_WARN_UNUSED + { return mClanName; } + /** * Sets the name of the primary guild the being is in. Shown in * BeingPopup (eventually). @@ -267,6 +271,8 @@ class Being notfinal : public ActorSprite, void setGuildPos(const std::string &restrict pos) restrict2; + void setClanName(const std::string &restrict name) restrict2; + /** * Adds a guild to the being. */ @@ -1055,6 +1061,8 @@ class Being notfinal : public ActorSprite, void showGuildBadge(const bool show) restrict2; + void showClanBadge(const bool show) restrict2; + void showGmBadge(const bool show) restrict2; void showPartyBadge(const bool show) restrict2; @@ -1178,6 +1186,7 @@ class Being notfinal : public ActorSprite, std::string mRaceName; std::string mPartyName; std::string mGuildName; + std::string mClanName; std::string mSpeech; /** |