summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/beinginfo.cpp3
-rw-r--r--src/resources/beinginfo.h7
-rw-r--r--src/resources/npcdb.cpp10
-rw-r--r--src/resources/npcdb.h4
4 files changed, 23 insertions, 1 deletions
diff --git a/src/resources/beinginfo.cpp b/src/resources/beinginfo.cpp
index c5c36b209..905d28921 100644
--- a/src/resources/beinginfo.cpp
+++ b/src/resources/beinginfo.cpp
@@ -48,7 +48,8 @@ BeingInfo::BeingInfo() :
mStaticMaxHP(false),
mTargetSelection(true),
mSortOffsetY(0),
- mDeadSortOffsetY(31)
+ mDeadSortOffsetY(31),
+ mAvatarId(0)
{
SpriteDisplay display;
display.sprites.push_back(SpriteReference::Empty);
diff --git a/src/resources/beinginfo.h b/src/resources/beinginfo.h
index 0e544a3b6..f1b978543 100644
--- a/src/resources/beinginfo.h
+++ b/src/resources/beinginfo.h
@@ -187,6 +187,12 @@ class BeingInfo final
void setDeadSortOffsetY(const int n)
{ mDeadSortOffsetY = n; }
+ uint16_t getAvatarId() const A_WARN_UNUSED
+ { return mAvatarId; }
+
+ void setAvatarId(const uint16_t id)
+ { mAvatarId = id; }
+
static void init();
static void clear();
@@ -207,6 +213,7 @@ class BeingInfo final
bool mTargetSelection;
int mSortOffsetY;
int mDeadSortOffsetY;
+ uint16_t mAvatarId;
};
typedef std::map<int, BeingInfo*> BeingInfos;
diff --git a/src/resources/npcdb.cpp b/src/resources/npcdb.cpp
index 07549eb03..f8e1e2340 100644
--- a/src/resources/npcdb.cpp
+++ b/src/resources/npcdb.cpp
@@ -95,6 +95,8 @@ void NPCDB::load()
currentInfo->setDeadSortOffsetY(XML::getProperty(npcNode,
"deadSortOffsetY", 31));
+ currentInfo->setAvatarId(XML::getProperty(npcNode, "avatar", 0));
+
SpriteDisplay display;
for_each_xml_child_node(spriteNode, npcNode)
{
@@ -148,3 +150,11 @@ BeingInfo *NPCDB::get(const int id)
return i->second;
}
}
+
+uint16_t NPCDB::getAvatarFor(const int id)
+{
+ BeingInfo *const info = get(id);
+ if (!info)
+ return 0;
+ return info->getAvatarId();
+}
diff --git a/src/resources/npcdb.h b/src/resources/npcdb.h
index 8f3d5650c..61641eaec 100644
--- a/src/resources/npcdb.h
+++ b/src/resources/npcdb.h
@@ -23,6 +23,8 @@
#ifndef NPC_DB_H
#define NPC_DB_H
+#include <stdint.h>
+
#include "localconsts.h"
class BeingInfo;
@@ -37,6 +39,8 @@ namespace NPCDB
void unload();
BeingInfo *get(const int id) A_WARN_UNUSED;
+
+ uint16_t getAvatarFor(const int id);
}
#endif