diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-05-13 22:03:58 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-05-13 22:03:58 +0300 |
commit | 546d5180247512270a2ccd114266fb36cd426e61 (patch) | |
tree | c87626cf176fef05e503637d3f68a79102a9a8fe /src/resources | |
parent | 9d93ff1cf9e33ec1304a7deadd84bfd690110142 (diff) | |
download | plus-546d5180247512270a2ccd114266fb36cd426e61.tar.gz plus-546d5180247512270a2ccd114266fb36cd426e61.tar.bz2 plus-546d5180247512270a2ccd114266fb36cd426e61.tar.xz plus-546d5180247512270a2ccd114266fb36cd426e61.zip |
Add check asserts in ItemDB. Also fix new asserts from log.
Diffstat (limited to 'src/resources')
-rw-r--r-- | src/resources/db/itemdb.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/resources/db/itemdb.cpp b/src/resources/db/itemdb.cpp index a6dcd48ab..6c79c12e8 100644 --- a/src/resources/db/itemdb.cpp +++ b/src/resources/db/itemdb.cpp @@ -38,6 +38,7 @@ #include "net/serverfeatures.h" +#include "utils/checkutils.h" #include "utils/delete2.h" #include "utils/dtor.h" #include "utils/files.h" @@ -285,7 +286,8 @@ void ItemDB::load() // Hairstyles are encoded as negative numbers. Count how far negative // we can go. int hairstyles = 1; - while (ItemDB::get(-hairstyles).getSprite(Gender::MALE, + while (ItemDB::exists(-hairstyles) && + ItemDB::get(-hairstyles).getSprite(Gender::MALE, BeingTypeId_zero) != paths.getStringValue("spriteErrorFile")) { hairstyles ++; @@ -293,7 +295,8 @@ void ItemDB::load() mNumberOfHairstyles = hairstyles; int races = 100; - while (ItemDB::get(-races).getSprite(Gender::MALE, BeingTypeId_zero) != + while (ItemDB::exists(-races) && + ItemDB::get(-races).getSprite(Gender::MALE, BeingTypeId_zero) != paths.getStringValue("spriteErrorFile")) { races ++; @@ -744,7 +747,7 @@ const ItemInfo &ItemDB::get(const int id) if (i == mItemInfos.end()) { - logger->log("ItemDB: Warning, unknown item ID# %d", id); + reportAlways("ItemDB: Warning, unknown item ID# %d", id); return *mUnknown; } |