From 67fd3978786c5f3f66b37fe22d0f7d657de69207 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 19 Jun 2016 19:19:11 +0300 Subject: Add asserts for missing colors in palettes. --- src/resources/iteminfo.cpp | 21 +++++++++++++++++++++ src/utils/checkutils.h | 2 ++ 2 files changed, 23 insertions(+) diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp index b23065f60..aa5d81b8e 100644 --- a/src/resources/iteminfo.cpp +++ b/src/resources/iteminfo.cpp @@ -33,6 +33,7 @@ #include "configuration.h" +#include "utils/checkutils.h" #include "utils/dtor.h" #include "debug.h" @@ -415,7 +416,12 @@ std::string ItemInfo::getColorName(const ItemColor idx) const const std::map ::const_iterator it = mColorsList->find(idx); if (it == mColorsList->end()) + { + reportAlways("Color %d for pallette %s not found", + CAST_S32(idx), + mColorsListName.c_str()); return std::string(); + } return it->second.name; } @@ -427,7 +433,12 @@ std::string ItemInfo::getColor(const ItemColor idx) const const std::map ::const_iterator it = mColorsList->find(idx); if (it == mColorsList->end()) + { + reportAlways("Color %d for pallette %s not found", + CAST_S32(idx), + mColorsListName.c_str()); return std::string(); + } return it->second.color; } @@ -439,7 +450,12 @@ std::string ItemInfo::getIconColorName(const ItemColor idx) const const std::map ::const_iterator it = mIconColorsList->find(idx); if (it == mIconColorsList->end()) + { + reportAlways("Color %d for pallette %s not found", + CAST_S32(idx), + mColorsListName.c_str()); return std::string(); + } return it->second.name; } @@ -451,7 +467,12 @@ std::string ItemInfo::getIconColor(const ItemColor idx) const const std::map ::const_iterator it = mIconColorsList->find(idx); if (it == mIconColorsList->end()) + { + reportAlways("Color %d for pallette %s not found", + CAST_S32(idx), + mColorsListName.c_str()); return std::string(); + } return it->second.color; } diff --git a/src/utils/checkutils.h b/src/utils/checkutils.h index 0423a0925..b780af587 100644 --- a/src/utils/checkutils.h +++ b/src/utils/checkutils.h @@ -21,6 +21,8 @@ #ifndef UTILS_CHECKUTILS_H #define UTILS_CHECKUTILS_H +#include "logger.h" + #ifdef ENABLE_ASSERTS #define reportFalseReal(val) \ -- cgit v1.2.3-70-g09d2