summaryrefslogtreecommitdiff
path: root/src/being
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-04-04 21:25:57 +0300
committerAndrei Karas <akaras@inbox.ru>2017-04-04 21:25:57 +0300
commit73a19644de201aa63ed9d1cf9feaa80873a85b4d (patch)
treeed11be06d0a58a433ed91a2db1526fb455d03811 /src/being
parent22bdb49dc36281ed99b1f2b5199ef36c9417dcf5 (diff)
downloadmanaplus-73a19644de201aa63ed9d1cf9feaa80873a85b4d.tar.gz
manaplus-73a19644de201aa63ed9d1cf9feaa80873a85b4d.tar.bz2
manaplus-73a19644de201aa63ed9d1cf9feaa80873a85b4d.tar.xz
manaplus-73a19644de201aa63ed9d1cf9feaa80873a85b4d.zip
Show player language badge.
Diffstat (limited to 'src/being')
-rw-r--r--src/being/being.cpp19
-rw-r--r--src/being/being.h3
2 files changed, 22 insertions, 0 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 45aa67bac..eef9b1d40 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -89,6 +89,7 @@
#include "resources/db/emotedb.h"
#include "resources/db/homunculusdb.h"
#include "resources/db/horsedb.h"
+#include "resources/db/languagedb.h"
#include "resources/db/mercenarydb.h"
#include "resources/db/monsterdb.h"
#include "resources/db/npcdb.h"
@@ -248,6 +249,7 @@ Being::Being(const BeingId id,
mManner(0),
mAreaSize(11),
mCastEndTime(0),
+ mLanguageId(-1),
mCreatorId(BeingId_zero),
mTeamId(0U),
mLook(0U),
@@ -5326,3 +5328,20 @@ void Being::fixDirectionOffsets(int &offsetX,
offsetX = tmp;
}
}
+
+void Being::setLanguageId(const int lang) restrict2 noexcept2
+{
+ if (lang != mLanguageId)
+ {
+ delete2(mBadges[BadgeIndex::Lang]);
+ const std::string badge = LanguageDb::getIcon(lang);
+ if (!badge.empty())
+ {
+ mBadges[BadgeIndex::Lang] = AnimatedSprite::load(pathJoin(
+ paths.getStringValue("languageIcons"),
+ badge));
+ }
+
+ mLanguageId = lang;
+ }
+}
diff --git a/src/being/being.h b/src/being/being.h
index ae4fe3dd8..0110f3141 100644
--- a/src/being/being.h
+++ b/src/being/being.h
@@ -1061,6 +1061,8 @@ class Being notfinal : public ActorSprite,
void showBadges(const bool show) restrict2;
+ void setLanguageId(const int lang) restrict2 noexcept2;
+
uint16_t getTeamId() const restrict2 noexcept2 A_WARN_UNUSED
{ return mTeamId; }
@@ -1323,6 +1325,7 @@ class Being notfinal : public ActorSprite,
int mManner;
int mAreaSize;
int mCastEndTime;
+ int mLanguageId;
BeingId mCreatorId;
uint16_t mTeamId;
uint16_t mLook;