From dde2d920e07d651b9571ada0b4c6a8cc58e4982a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 11 Jun 2013 16:17:36 +0300 Subject: add partial support for player look. can change look in char creation dialog, but cant render different look. --- src/resources/chardb.cpp | 16 ++++++++++++++++ src/resources/chardb.h | 4 ++++ src/resources/colordb.h | 4 ++-- src/resources/iteminfo.cpp | 12 ++++++++++++ src/resources/iteminfo.h | 5 +++++ 5 files changed, 39 insertions(+), 2 deletions(-) (limited to 'src/resources') 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 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 &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 &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(gender) + race * 4] = animationFile; } + +std::string ItemInfo::getColorName(const int idx) const +{ + if (!mColors) + return std::string(); + + const std::map ::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]; -- cgit v1.2.3-70-g09d2