summaryrefslogtreecommitdiff
path: root/src/being
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-02-13 05:24:46 +0300
committerAndrei Karas <akaras@inbox.ru>2018-02-13 05:24:46 +0300
commit869cb1c660310140f02a0b3804e02a2f3c4a0326 (patch)
tree2f0df222ebf1292d17aba1f8b0fe66866a18b330 /src/being
parent3a4d8f947b0358c636f983b4248777e8371678dd (diff)
downloadmv-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')
-rw-r--r--src/being/being.cpp28
-rw-r--r--src/being/being.h9
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;
/**