summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-09-05 17:51:47 +0300
committerAndrei Karas <akaras@inbox.ru>2015-09-05 17:55:53 +0300
commitd4841f5ec6d954bce7f628a33b8394550e32a057 (patch)
tree90d3f8f56d66a5bfcdcd111139260b79cdec606f /src
parent8c8e641b2ce47daa2f824a87b27d63bfeb609098 (diff)
downloadmanaverse-d4841f5ec6d954bce7f628a33b8394550e32a057.tar.gz
manaverse-d4841f5ec6d954bce7f628a33b8394550e32a057.tar.bz2
manaverse-d4841f5ec6d954bce7f628a33b8394550e32a057.tar.xz
manaverse-d4841f5ec6d954bce7f628a33b8394550e32a057.zip
Add away being badge.
Diffstat (limited to 'src')
-rw-r--r--src/being/being.cpp26
-rw-r--r--src/being/being.h2
-rw-r--r--src/defaults.cpp1
3 files changed, 25 insertions, 4 deletions
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;
diff --git a/src/being/being.h b/src/being/being.h
index 47a904479..3105edc0e 100644
--- a/src/being/being.h
+++ b/src/being/being.h
@@ -946,6 +946,8 @@ class Being notfinal : public ActorSprite,
void showInactiveBadge(const bool show);
+ void showAwayBadge(const bool show);
+
void showBadges(const bool show);
uint16_t getTeamId() const
diff --git a/src/defaults.cpp b/src/defaults.cpp
index 83c53c129..ca2b31e04 100644
--- a/src/defaults.cpp
+++ b/src/defaults.cpp
@@ -609,6 +609,7 @@ DefaultsData* getPathsDefaults()
AddDEF("gmbadge", "gm.xml");
AddDEF("shopbadge", "shop.xml");
AddDEF("inactivebadge", "inactive.xml");
+ AddDEF("awaybadge", "away.xml");
return configData;
}