From 5e70bf11d9715dec5678f787cee838ddbaaaf063 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 12 Jul 2017 22:11:56 +0300 Subject: Show group name in being popup and status window. --- src/gui/popups/beingpopup.cpp | 15 +++++++++++++++ src/gui/windows/statuswindow.cpp | 11 ++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) (limited to 'src/gui') diff --git a/src/gui/popups/beingpopup.cpp b/src/gui/popups/beingpopup.cpp index 015134c9f..c9e9e8608 100644 --- a/src/gui/popups/beingpopup.cpp +++ b/src/gui/popups/beingpopup.cpp @@ -35,6 +35,8 @@ #include "resources/chatobject.h" +#include "resources/db/groupdb.h" + #include "utils/gettext.h" #include "utils/foreach.h" #include "utils/stringutils.h" @@ -168,6 +170,19 @@ void BeingPopup::show(const int x, const int y, Being *const b) } else { + const int groupId = b->getGroupId(); + const std::string groupName = GroupDb::getLongName(groupId); + if (!groupName.empty()) + { + ptr = mLabels[num]; + // TRANSLATORS: being popup label + ptr->setCaption(strprintf(_("Group: %s (%d)"), + groupName.c_str(), + groupId)); + ptr->adjustSize(); + num ++; + } + if (!(b->getPartyName().empty())) { ptr = mLabels[num]; diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp index 5e79f6b73..c40ba819c 100644 --- a/src/gui/windows/statuswindow.cpp +++ b/src/gui/windows/statuswindow.cpp @@ -48,6 +48,7 @@ #include "net/inventoryhandler.h" #include "net/playerhandler.h" +#include "resources/db/groupdb.h" #include "resources/db/unitsdb.h" #include "resources/db/statdb.h" @@ -259,12 +260,16 @@ void StatusWindow::addTabBasic(const std::string &name) void StatusWindow::updateLevelLabel() { - if ((localPlayer != nullptr) && localPlayer->isGM()) + const int groupId = localPlayer->getGroupId(); + const std::string name = GroupDb::getName(groupId); + if (localPlayer != nullptr && + !name.empty()) { // TRANSLATORS: status window label - mLvlLabel->setCaption(strprintf(_("Level: %d (GM %d)"), + mLvlLabel->setCaption(strprintf(_("Level: %d (%s %d)"), PlayerInfo::getAttribute(Attributes::PLAYER_LEVEL), - localPlayer->getGroupId())); + name.c_str(), + groupId)); } else { -- cgit v1.2.3-60-g2f50