summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-09-05 17:05:55 +0300
committerAndrei Karas <akaras@inbox.ru>2015-09-05 17:55:52 +0300
commit720b445bf4eea777d1fac9bac4c23aae59062826 (patch)
tree26941b003c1598fafb211ab909a8096df14655e8 /src
parentdf5cdaf58478f3b6309b52c36b1696e5fe8dc157 (diff)
downloadmanaverse-720b445bf4eea777d1fac9bac4c23aae59062826.tar.gz
manaverse-720b445bf4eea777d1fac9bac4c23aae59062826.tar.bz2
manaverse-720b445bf4eea777d1fac9bac4c23aae59062826.tar.xz
manaverse-720b445bf4eea777d1fac9bac4c23aae59062826.zip
Add shop badge to beings.
Diffstat (limited to 'src')
-rw-r--r--src/being/being.cpp24
-rw-r--r--src/being/being.h2
-rw-r--r--src/defaults.cpp1
3 files changed, 26 insertions, 1 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 902811206..1980436d5 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -2100,7 +2100,7 @@ std::string Being::getGenderSign() const
}
if (mShowPlayersStatus)
{
- if (mShop)
+ if (mShop && !mShowBadges)
str.append("$");
if (mAway)
{
@@ -2517,6 +2517,7 @@ bool Being::updateFromCache()
mInactive = false;
}
+ showShopBadge(mShop);
updateAwayEffect();
if (mType == ActorType::Player || mTeamId)
updateColors();
@@ -3368,6 +3369,7 @@ void Being::setState(const uint8_t state)
mAway = away;
mInactive = inactive;
updateAwayEffect();
+ showShopBadge(mShop);
if (needUpdate)
{
@@ -3880,6 +3882,7 @@ void Being::showBadges(const bool show)
showGmBadge(show);
showPartyBadge(show);
showNameBadge(show);
+ showShopBadge(show);
}
void Being::showPartyBadge(const bool show)
@@ -3897,6 +3900,7 @@ void Being::showPartyBadge(const bool show)
updateBadgesCount();
}
+
void Being::setPartyName(const std::string &name)
{
if (mPartyName != name)
@@ -3906,6 +3910,21 @@ void Being::setPartyName(const std::string &name)
}
}
+void Being::showShopBadge(const bool show)
+{
+ delete2(mBadges[BadgeIndex::Shop]);
+ if (show && mShop && mShowBadges)
+ {
+ const std::string badge = paths.getStringValue("shopbadge");
+ if (!badge.empty())
+ {
+ mBadges[BadgeIndex::Shop] = AnimatedSprite::load(
+ paths.getStringValue("badges") + badge);
+ }
+ }
+ updateBadgesCount();
+}
+
void Being::updateBadgesCount()
{
mBadgesCount = 0;
@@ -3928,6 +3947,7 @@ void Being::setSellBoard(const std::string &text)
mShop = !text.empty() || !mBuyBoard.empty();
mSellBoard = text;
updateName();
+ showShopBadge(mShop);
}
void Being::setBuyBoard(const std::string &text)
@@ -3935,6 +3955,7 @@ void Being::setBuyBoard(const std::string &text)
mShop = !text.empty() || !mSellBoard.empty();
mBuyBoard = text;
updateName();
+ showShopBadge(mShop);
}
#endif
@@ -3942,6 +3963,7 @@ void Being::enableShop(const bool b)
{
mShop = b;
updateName();
+ showShopBadge(mShop);
}
bool Being::isBuyShopEnabled() const
diff --git a/src/being/being.h b/src/being/being.h
index 7defdc9e9..656eb21fb 100644
--- a/src/being/being.h
+++ b/src/being/being.h
@@ -942,6 +942,8 @@ class Being notfinal : public ActorSprite,
void showNameBadge(const bool show);
+ void showShopBadge(const bool show);
+
void showBadges(const bool show);
uint16_t getTeamId() const
diff --git a/src/defaults.cpp b/src/defaults.cpp
index 2745d6f29..2d3b24410 100644
--- a/src/defaults.cpp
+++ b/src/defaults.cpp
@@ -607,6 +607,7 @@ DefaultsData* getPathsDefaults()
AddDEF("team2badge", "team2.xml");
AddDEF("team3badge", "team3.xml");
AddDEF("gmbadge", "gm.xml");
+ AddDEF("shopbadge", "shop.xml");
return configData;
}