diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-09-05 17:05:55 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-09-05 17:55:52 +0300 |
commit | 720b445bf4eea777d1fac9bac4c23aae59062826 (patch) | |
tree | 26941b003c1598fafb211ab909a8096df14655e8 | |
parent | df5cdaf58478f3b6309b52c36b1696e5fe8dc157 (diff) | |
download | mv-720b445bf4eea777d1fac9bac4c23aae59062826.tar.gz mv-720b445bf4eea777d1fac9bac4c23aae59062826.tar.bz2 mv-720b445bf4eea777d1fac9bac4c23aae59062826.tar.xz mv-720b445bf4eea777d1fac9bac4c23aae59062826.zip |
Add shop badge to beings.
-rw-r--r-- | data/graphics/badges/CMakeLists.txt | 2 | ||||
-rw-r--r-- | data/graphics/badges/Makefile.am | 2 | ||||
-rw-r--r-- | data/graphics/badges/shop.png | bin | 0 -> 301 bytes | |||
-rw-r--r-- | data/graphics/badges/shop.xml | 15 | ||||
-rw-r--r-- | src/being/being.cpp | 24 | ||||
-rw-r--r-- | src/being/being.h | 2 | ||||
-rw-r--r-- | src/defaults.cpp | 1 |
7 files changed, 45 insertions, 1 deletions
diff --git a/data/graphics/badges/CMakeLists.txt b/data/graphics/badges/CMakeLists.txt index d8fad83de..22110ba93 100644 --- a/data/graphics/badges/CMakeLists.txt +++ b/data/graphics/badges/CMakeLists.txt @@ -1,6 +1,8 @@ SET(FILES gm.png gm.xml + shop.png + shop.xml team1.png team1.xml team2.png diff --git a/data/graphics/badges/Makefile.am b/data/graphics/badges/Makefile.am index d6f5e41df..4e8b57e04 100644 --- a/data/graphics/badges/Makefile.am +++ b/data/graphics/badges/Makefile.am @@ -3,6 +3,8 @@ badgesdir = $(pkgdatadir)/data/graphics/badges badges_DATA = \ gm.png \ gm.xml \ + shop.png \ + shop.xml \ team1.png \ team1.xml \ team2.png \ diff --git a/data/graphics/badges/shop.png b/data/graphics/badges/shop.png Binary files differnew file mode 100644 index 000000000..ffc71179c --- /dev/null +++ b/data/graphics/badges/shop.png diff --git a/data/graphics/badges/shop.xml b/data/graphics/badges/shop.xml new file mode 100644 index 000000000..4189056eb --- /dev/null +++ b/data/graphics/badges/shop.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/shop.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 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; } |