From 70e304a900be02a734b6ebe7517b81bbe786a79f Mon Sep 17 00:00:00 2001
From: Andrei Karas <akaras@inbox.ru>
Date: Thu, 20 Jul 2017 18:52:42 +0300
Subject: In popupmenu get group for local player before each menu.

---
 src/resources/db/groupdb.cpp | 11 +++++++++++
 src/resources/db/groupdb.h   |  1 +
 2 files changed, 12 insertions(+)

(limited to 'src/resources')

diff --git a/src/resources/db/groupdb.cpp b/src/resources/db/groupdb.cpp
index fc61033cc..7b499018a 100644
--- a/src/resources/db/groupdb.cpp
+++ b/src/resources/db/groupdb.cpp
@@ -372,6 +372,17 @@ const std::string &GroupDb::getBadge(const int id)
     return (*it).second->badge;
 }
 
+const GroupInfo *GroupDb::getGroup(const int id)
+{
+    GroupInfos::const_iterator it = mGroups.find(id);
+    if (it == mGroups.end())
+    {
+        reportAlways("Unknown group id requested: %d", id);
+        return &mEmptyGroup;
+    }
+    return (*it).second;
+}
+
 #ifdef UNITTESTS
 GroupDb::GroupInfos &GroupDb::getGroups()
 {
diff --git a/src/resources/db/groupdb.h b/src/resources/db/groupdb.h
index 0115880bc..020649001 100644
--- a/src/resources/db/groupdb.h
+++ b/src/resources/db/groupdb.h
@@ -42,6 +42,7 @@ namespace GroupDb
     const std::string &getLongName(const int id) A_WARN_UNUSED;
     bool getShowBadge(const int id) A_WARN_UNUSED;
     const std::string &getBadge(const int id) A_WARN_UNUSED;
+    const GroupInfo *getGroup(const int id) A_WARN_UNUSED RETURNS_NONNULL;
 
     typedef std::map<int, GroupInfo*> GroupInfos;
     typedef GroupInfos::iterator GroupInfosIter;
-- 
cgit v1.2.3-70-g09d2