diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-03-05 17:29:03 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-03-05 17:29:03 +0300 |
commit | 3fae3f59aad1f1f2eee1e1bfa088672787bc9c78 (patch) | |
tree | 570faffa2f7e786bc00feb2519031d6c46fedd0e /src/resources/db/itemdb.cpp | |
parent | 34bc5498ea3098ca83d454b1745255f060ab2797 (diff) | |
download | mv-3fae3f59aad1f1f2eee1e1bfa088672787bc9c78.tar.gz mv-3fae3f59aad1f1f2eee1e1bfa088672787bc9c78.tar.bz2 mv-3fae3f59aad1f1f2eee1e1bfa088672787bc9c78.tar.xz mv-3fae3f59aad1f1f2eee1e1bfa088672787bc9c78.zip |
Move getNumOfHairstyles from being to itemdb.
Diffstat (limited to 'src/resources/db/itemdb.cpp')
-rw-r--r-- | src/resources/db/itemdb.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/resources/db/itemdb.cpp b/src/resources/db/itemdb.cpp index 3b942797d..cd860df71 100644 --- a/src/resources/db/itemdb.cpp +++ b/src/resources/db/itemdb.cpp @@ -55,6 +55,8 @@ namespace StringVect mTagNames; StringIntMap mTags; std::map<std::string, ItemSoundEvent::Type> mSoundNames; + int mNumberOfHairstyles = 1; + int mNumberOfRaces = 1; } // namespace // Forward declarations @@ -255,6 +257,24 @@ void ItemDB::load() ".xml"); FOR_EACH (StringVectCIter, it, list) loadXmlFile(*it, tagNum); + + // Hairstyles are encoded as negative numbers. Count how far negative + // we can go. + int hairstyles = 1; + while (ItemDB::get(-hairstyles).getSprite(Gender::MALE, + BeingTypeId_zero) != paths.getStringValue("spriteErrorFile")) + { + hairstyles ++; + } + mNumberOfHairstyles = hairstyles; + + int races = 100; + while (ItemDB::get(-races).getSprite(Gender::MALE, BeingTypeId_zero) != + paths.getStringValue("spriteErrorFile")) + { + races ++; + } + mNumberOfRaces = races - 100; } void ItemDB::loadXmlFile(const std::string &fileName, int &tagNum) @@ -1072,6 +1092,11 @@ std::string ItemDB::getNamesStr(const std::vector<int> &parts) return str; } +int ItemDB::getNumOfHairstyles() +{ + return mNumberOfHairstyles; +} + #ifdef UNITTESTS ItemDB::NamedItemInfos &ItemDB::getNamedItemInfosTest() { |