diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-07-13 20:50:34 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-07-13 20:50:34 +0300 |
commit | 5525260f78c1fcab1887cdc95ebcc6790fb34b5b (patch) | |
tree | bd8ee201beef1fc3bbbe48890f9695b6c39c874b /src/resources/db/groupdb.cpp | |
parent | 1f72c8a3f380325f5f4a82137f8bac02362916df (diff) | |
download | manaplus-5525260f78c1fcab1887cdc95ebcc6790fb34b5b.tar.gz manaplus-5525260f78c1fcab1887cdc95ebcc6790fb34b5b.tar.bz2 manaplus-5525260f78c1fcab1887cdc95ebcc6790fb34b5b.tar.xz manaplus-5525260f78c1fcab1887cdc95ebcc6790fb34b5b.zip |
Allow use different badges for each group in groups.xml
Diffstat (limited to 'src/resources/db/groupdb.cpp')
-rw-r--r-- | src/resources/db/groupdb.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/resources/db/groupdb.cpp b/src/resources/db/groupdb.cpp index c65406841..bd78e117c 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].badge = XML::langProperty(node, + "badge", + paths.getStringValue("gmbadge")); mGroups[id].showBadge = XML::getBoolProperty(node, "showBadge", false); @@ -142,6 +145,17 @@ bool GroupDb::getShowBadge(const int id) return (*it).second.showBadge; } +const std::string &GroupDb::getBadge(const int id) +{ + GroupInfos::const_iterator it = mGroups.find(id); + if (it == mGroups.end()) + { + reportAlways("Unknown group id requested: %d", id); + return mEmptyGroup.badge; + } + return (*it).second.badge; +} + #ifdef UNITTESTS GroupDb::GroupInfos &GroupDb::getGroups() { |