From d4841f5ec6d954bce7f628a33b8394550e32a057 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 5 Sep 2015 17:51:47 +0300 Subject: Add away being badge. --- src/being/being.cpp | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'src/being/being.cpp') diff --git a/src/being/being.cpp b/src/being/being.cpp index 63be12ebe..b3cda4463 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -2098,16 +2098,16 @@ std::string Being::getGenderSign() const else if (getGender() == Gender::MALE) str = "\u2642"; } - if (mShowPlayersStatus) + if (mShowPlayersStatus && !mShowBadges) { - if (mShop && !mShowBadges) + if (mShop) str.append("$"); if (mAway) { // TRANSLATORS: this away status writed in player nick str.append(_("A")); } - else if (mInactive && !mShowBadges) + else if (mInactive) { // TRANSLATORS: this inactive status writed in player nick str.append(_("I")); @@ -2519,6 +2519,7 @@ bool Being::updateFromCache() showShopBadge(mShop); showInactiveBadge(mInactive); + showAwayBadge(mInactive); updateAwayEffect(); if (mType == ActorType::Player || mTeamId) updateColors(); @@ -3372,6 +3373,7 @@ void Being::setState(const uint8_t state) updateAwayEffect(); showShopBadge(mShop); showInactiveBadge(mInactive); + showAwayBadge(mInactive); if (needUpdate) { @@ -3886,6 +3888,7 @@ void Being::showBadges(const bool show) showNameBadge(show); showShopBadge(show); showInactiveBadge(show); + showAwayBadge(show); } void Being::showPartyBadge(const bool show) @@ -3931,7 +3934,7 @@ void Being::showShopBadge(const bool show) void Being::showInactiveBadge(const bool show) { delete2(mBadges[BadgeIndex::Inactive]); - if (show && mShop && mShowBadges) + if (show && mInactive && mShowBadges) { const std::string badge = paths.getStringValue("inactivebadge"); if (!badge.empty()) @@ -3943,6 +3946,21 @@ void Being::showInactiveBadge(const bool show) updateBadgesCount(); } +void Being::showAwayBadge(const bool show) +{ + delete2(mBadges[BadgeIndex::Away]); + if (show && mAway && mShowBadges) + { + const std::string badge = paths.getStringValue("awaybadge"); + if (!badge.empty()) + { + mBadges[BadgeIndex::Away] = AnimatedSprite::load( + paths.getStringValue("badges") + badge); + } + } + updateBadgesCount(); +} + void Being::updateBadgesCount() { mBadgesCount = 0; -- cgit v1.2.3-60-g2f50