summaryrefslogtreecommitdiff
path: root/src/being/being.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-07-29 21:11:40 +0300
committerAndrei Karas <akaras@inbox.ru>2015-07-29 21:11:40 +0300
commit0fe12f569879f90b8b6efab790ba896b9769a3d4 (patch)
treeb81fe57e9defa337c79ab89d37c35bb3bbd8de06 /src/being/being.cpp
parentaa0bda1d887709c13c64308d33087ad7fc1ac0bf (diff)
downloadmv-0fe12f569879f90b8b6efab790ba896b9769a3d4.tar.gz
mv-0fe12f569879f90b8b6efab790ba896b9769a3d4.tar.bz2
mv-0fe12f569879f90b8b6efab790ba896b9769a3d4.tar.xz
mv-0fe12f569879f90b8b6efab790ba896b9769a3d4.zip
Fix enable/disable badges without client restart.
Diffstat (limited to 'src/being/being.cpp')
-rw-r--r--src/being/being.cpp92
1 files changed, 58 insertions, 34 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 987971a78..23e4da309 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -1006,21 +1006,26 @@ void Being::setShowName(const bool doShowName)
delete2(mDispName)
}
+void Being::showGuildBadge(const bool show)
+{
+ delete2(mGuildBadge);
+ if (show && !mGuildName.empty() && mShowBadges)
+ {
+ const std::string badge = BadgesDB::getGuildBadge(mGuildName);
+ if (!badge.empty())
+ {
+ mGuildBadge = AnimatedSprite::load(
+ paths.getStringValue("badges") + badge);
+ }
+ }
+}
+
void Being::setGuildName(const std::string &name)
{
if (mGuildName != name)
{
- delete2(mGuildBadge);
mGuildName = name;
- if (!mGuildName.empty() && mShowBadges)
- {
- const std::string badge = BadgesDB::getGuildBadge(mGuildName);
- if (!badge.empty())
- {
- mGuildBadge = AnimatedSprite::load(
- paths.getStringValue("badges") + badge);
- }
- }
+ showGuildBadge(!mGuildName.empty());
updateBadgesCount();
}
}
@@ -2577,23 +2582,29 @@ void Being::setGender(const GenderT gender)
}
}
+void Being::showGmBadge(const bool show)
+{
+ delete2(mGmBadge);
+ if (show && mIsGM && mShowBadges)
+ {
+ const std::string gmBadge = paths.getStringValue("gmbadge");
+ if (!gmBadge.empty())
+ {
+ mGmBadge = AnimatedSprite::load(
+ paths.getStringValue("badges") + gmBadge);
+ }
+ }
+ updateBadgesCount();
+}
+
void Being::setGM(const bool gm)
{
if (mIsGM != gm)
{
- delete2(mGmBadge);
mIsGM = gm;
- if (mIsGM && mShowBadges)
- {
- const std::string gmBadge = paths.getStringValue("gmbadge");
- if (!gmBadge.empty())
- {
- mGmBadge = AnimatedSprite::load(
- paths.getStringValue("badges") + gmBadge);
- }
- }
+
+ showGmBadge(mIsGM);
updateColors();
- updateBadgesCount();
}
}
@@ -3781,12 +3792,12 @@ void Being::setTeamId(const uint16_t teamId)
if (mTeamId != teamId)
{
mTeamId = teamId;
- showBadges(mTeamId != 0);
+ showTeamBadge(mTeamId != 0);
updateColors();
}
}
-void Being::showBadges(const bool show)
+void Being::showTeamBadge(const bool show)
{
delete2(mTeamBadge);
if (show && mTeamId && mShowBadges)
@@ -3800,22 +3811,35 @@ void Being::showBadges(const bool show)
updateBadgesCount();
}
+void Being::showBadges(const bool show)
+{
+ showTeamBadge(show);
+ showGuildBadge(show);
+ showGmBadge(show);
+ showPartyBadge(show);
+}
+
+void Being::showPartyBadge(const bool show)
+{
+ delete2(mPartyBadge);
+ if (show && !mPartyName.empty() && mShowBadges)
+ {
+ const std::string badge = BadgesDB::getPartyBadge(mPartyName);
+ if (!badge.empty())
+ {
+ mPartyBadge = AnimatedSprite::load(
+ paths.getStringValue("badges") + badge);
+ }
+ }
+ updateBadgesCount();
+}
+
void Being::setPartyName(const std::string &name)
{
if (mPartyName != name)
{
- delete2(mPartyBadge);
mPartyName = name;
- if (!mPartyName.empty() && mShowBadges)
- {
- const std::string badge = BadgesDB::getPartyBadge(mPartyName);
- if (!badge.empty())
- {
- mPartyBadge = AnimatedSprite::load(
- paths.getStringValue("badges") + badge);
- }
- }
- updateBadgesCount();
+ showPartyBadge(!mPartyName.empty());
}
}