summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-07-13 20:22:52 +0300
committerAndrei Karas <akaras@inbox.ru>2017-07-13 20:22:52 +0300
commit1f72c8a3f380325f5f4a82137f8bac02362916df (patch)
tree1fe50a1ae4dbf5c50358be2624d10c88af1ccb1f /src
parent56373bec70b817dded49a3de69a21cdbee21873f (diff)
downloadplus-1f72c8a3f380325f5f4a82137f8bac02362916df.tar.gz
plus-1f72c8a3f380325f5f4a82137f8bac02362916df.tar.bz2
plus-1f72c8a3f380325f5f4a82137f8bac02362916df.tar.xz
plus-1f72c8a3f380325f5f4a82137f8bac02362916df.zip
Add property "showBadge" to groups.
For default groups.xml show badges only for group id == 60.
Diffstat (limited to 'src')
-rw-r--r--src/being/being.cpp6
-rw-r--r--src/resources/db/groupdb.cpp14
-rw-r--r--src/resources/db/groupdb.h1
-rw-r--r--src/resources/groupinfo.h4
4 files changed, 23 insertions, 2 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index ff8593c11..147be14a4 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -86,6 +86,7 @@
#include "resources/db/avatardb.h"
#include "resources/db/badgesdb.h"
+#include "resources/db/groupdb.h"
#include "resources/db/elementaldb.h"
#include "resources/db/emotedb.h"
#include "resources/db/homunculusdb.h"
@@ -3498,7 +3499,10 @@ void Being::setGender(const GenderT gender) restrict2
void Being::showGmBadge(const bool show) restrict2
{
delete2(mBadges[BadgeIndex::Gm]);
- if (show && mIsGM && (mShowBadges != 0u))
+ if (show &&
+ mIsGM &&
+ mShowBadges != 0u &&
+ GroupDb::getShowBadge(mGroupId))
{
const std::string gmBadge = paths.getStringValue("gmbadge");
if (!gmBadge.empty())
diff --git a/src/resources/db/groupdb.cpp b/src/resources/db/groupdb.cpp
index 4b25e94bd..c65406841 100644
--- a/src/resources/db/groupdb.cpp
+++ b/src/resources/db/groupdb.cpp
@@ -96,6 +96,9 @@ void GroupDb::loadXmlFile(const std::string &fileName,
mGroups[id].longName = XML::langProperty(node,
"longName",
"");
+ mGroups[id].showBadge = XML::getBoolProperty(node,
+ "showBadge",
+ false);
}
}
}
@@ -128,6 +131,17 @@ const std::string &GroupDb::getLongName(const int id)
return (*it).second.longName;
}
+bool GroupDb::getShowBadge(const int id)
+{
+ GroupInfos::const_iterator it = mGroups.find(id);
+ if (it == mGroups.end())
+ {
+ reportAlways("Unknown group id requested: %d", id);
+ return mEmptyGroup.showBadge;
+ }
+ return (*it).second.showBadge;
+}
+
#ifdef UNITTESTS
GroupDb::GroupInfos &GroupDb::getGroups()
{
diff --git a/src/resources/db/groupdb.h b/src/resources/db/groupdb.h
index f2c027120..4e687dea9 100644
--- a/src/resources/db/groupdb.h
+++ b/src/resources/db/groupdb.h
@@ -40,6 +40,7 @@ namespace GroupDb
const SkipError skipError);
const std::string &getName(const int id);
const std::string &getLongName(const int id);
+ bool getShowBadge(const int id);
typedef std::map<int, GroupInfo> GroupInfos;
diff --git a/src/resources/groupinfo.h b/src/resources/groupinfo.h
index 1ca0ed30e..59a79a9bd 100644
--- a/src/resources/groupinfo.h
+++ b/src/resources/groupinfo.h
@@ -29,13 +29,15 @@ struct GroupInfo final
{
GroupInfo() :
name(),
- longName()
+ longName(),
+ showBadge(false)
{ }
A_DEFAULT_COPY(GroupInfo)
std::string name;
std::string longName;
+ bool showBadge;
};
#endif // RESOURCES_GROUPINFO_H