summaryrefslogtreecommitdiff
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
parent8c8e641b2ce47daa2f824a87b27d63bfeb609098 (diff)
downloadmanaverse-d4841f5ec6d954bce7f628a33b8394550e32a057.tar.gz
manaverse-d4841f5ec6d954bce7f628a33b8394550e32a057.tar.bz2
manaverse-d4841f5ec6d954bce7f628a33b8394550e32a057.tar.xz
manaverse-d4841f5ec6d954bce7f628a33b8394550e32a057.zip
Add away being badge.
-rw-r--r--data/graphics/badges/CMakeLists.txt2
-rw-r--r--data/graphics/badges/Makefile.am2
-rw-r--r--data/graphics/badges/away.pngbin0 -> 255 bytes
-rw-r--r--data/graphics/badges/away.xml15
-rw-r--r--src/being/being.cpp26
-rw-r--r--src/being/being.h2
-rw-r--r--src/defaults.cpp1
7 files changed, 44 insertions, 4 deletions
diff --git a/data/graphics/badges/CMakeLists.txt b/data/graphics/badges/CMakeLists.txt
index 52334e660..b8e7002fb 100644
--- a/data/graphics/badges/CMakeLists.txt
+++ b/data/graphics/badges/CMakeLists.txt
@@ -1,4 +1,6 @@
SET(FILES
+ away.png
+ away.xml
gm.png
gm.xml
inactive.png
diff --git a/data/graphics/badges/Makefile.am b/data/graphics/badges/Makefile.am
index 3a05e7a7f..b8d3eca94 100644
--- a/data/graphics/badges/Makefile.am
+++ b/data/graphics/badges/Makefile.am
@@ -1,6 +1,8 @@
badgesdir = $(pkgdatadir)/data/graphics/badges
badges_DATA = \
+ away.png \
+ away.xml \
gm.png \
gm.xml \
inactive.png \
diff --git a/data/graphics/badges/away.png b/data/graphics/badges/away.png
new file mode 100644
index 000000000..4c7c7de64
--- /dev/null
+++ b/data/graphics/badges/away.png
Binary files differ
diff --git a/data/graphics/badges/away.xml b/data/graphics/badges/away.xml
new file mode 100644
index 000000000..85e1dda8d
--- /dev/null
+++ b/data/graphics/badges/away.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Author: 4144
+Copyright (C) 2015 ManaPlus developers -->
+<sprite>
+ <imageset name="icon"
+ src="graphics/badges/away.png"
+ width="16"
+ height="16"
+ offsetY="0"/>
+ <action name="default" imageset="icon">
+ <animation direction="default">
+ <frame index="0"/>
+ </animation>
+ </action>
+</sprite>
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;
}