summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-06-11 16:17:36 +0300
committerAndrei Karas <akaras@inbox.ru>2013-06-11 16:17:36 +0300
commitdde2d920e07d651b9571ada0b4c6a8cc58e4982a (patch)
treea1b7b52d9f35222ff7e30dcf458191bb4ed33ace /src/resources
parentb6df3c3999d4be067e7314e3887e583c13ad1624 (diff)
downloadmanaplus-dde2d920e07d651b9571ada0b4c6a8cc58e4982a.tar.gz
manaplus-dde2d920e07d651b9571ada0b4c6a8cc58e4982a.tar.bz2
manaplus-dde2d920e07d651b9571ada0b4c6a8cc58e4982a.tar.xz
manaplus-dde2d920e07d651b9571ada0b4c6a8cc58e4982a.zip
add partial support for player look.
can change look in char creation dialog, but cant render different look.
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/chardb.cpp16
-rw-r--r--src/resources/chardb.h4
-rw-r--r--src/resources/colordb.h4
-rw-r--r--src/resources/iteminfo.cpp12
-rw-r--r--src/resources/iteminfo.h5
5 files changed, 39 insertions, 2 deletions
diff --git a/src/resources/chardb.cpp b/src/resources/chardb.cpp
index 1111177e1..73582e989 100644
--- a/src/resources/chardb.cpp
+++ b/src/resources/chardb.cpp
@@ -37,6 +37,8 @@ namespace
unsigned mMinStat = 0;
unsigned mMaxStat = 0;
unsigned mSumStat = 0;
+ unsigned mMinLook = 0;
+ unsigned mMaxLook = 0;
std::vector<int> mDefaultItems;
} // namespace
@@ -67,6 +69,10 @@ void CharDB::load()
{
loadMinMax(node, &mMinHairStyle, &mMaxHairStyle);
}
+ else if (xmlNameEqual(node, "look"))
+ {
+ loadMinMax(node, &mMinLook, &mMaxLook);
+ }
else if (xmlNameEqual(node, "stat"))
{
loadMinMax(node, &mMinStat, &mMaxStat);
@@ -134,6 +140,16 @@ unsigned CharDB::getSumStat()
return mSumStat;
}
+unsigned CharDB::getMinLook()
+{
+ return mMinLook;
+}
+
+unsigned CharDB::getMaxLook()
+{
+ return mMaxLook;
+}
+
const std::vector<int> &CharDB::getDefaultItems()
{
return mDefaultItems;
diff --git a/src/resources/chardb.h b/src/resources/chardb.h
index 52f4cb8bc..b61d61e1d 100644
--- a/src/resources/chardb.h
+++ b/src/resources/chardb.h
@@ -61,6 +61,10 @@ namespace CharDB
unsigned getSumStat() A_WARN_UNUSED;
+ unsigned getMinLook() A_WARN_UNUSED;
+
+ unsigned getMaxLook() A_WARN_UNUSED;
+
const std::vector<int> &getDefaultItems() A_WARN_UNUSED;
} // namespace CharDB
diff --git a/src/resources/colordb.h b/src/resources/colordb.h
index ad69799d9..3eec3625d 100644
--- a/src/resources/colordb.h
+++ b/src/resources/colordb.h
@@ -37,8 +37,8 @@ namespace ColorDB
public:
ItemColor():
id(0),
- name(""),
- color("")
+ name(),
+ color()
{ }
ItemColor(const int id0, const std::string &name0,
diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp
index e9a550cda..78740522f 100644
--- a/src/resources/iteminfo.cpp
+++ b/src/resources/iteminfo.cpp
@@ -309,3 +309,15 @@ void ItemInfo::setSprite(const std::string &animationFile,
{
mAnimationFiles[static_cast<int>(gender) + race * 4] = animationFile;
}
+
+std::string ItemInfo::getColorName(const int idx) const
+{
+ if (!mColors)
+ return std::string();
+
+ const std::map <int, ColorDB::ItemColor>::const_iterator
+ it = mColors->find(idx);
+ if (it == mColors->end())
+ return std::string();
+ return it->second.name;
+}
diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h
index a3b606dc8..3e6d0d249 100644
--- a/src/resources/iteminfo.h
+++ b/src/resources/iteminfo.h
@@ -292,6 +292,11 @@ class ItemInfo final
bool isProtected() const
{ return mProtected; }
+ int getColorsSize() const
+ { return mColors ? mColors->size() : 0; }
+
+ std::string getColorName(const int idx) const;
+
int mDrawBefore[10];
int mDrawAfter[10];
int mDrawPriority[10];