summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-06-19 19:19:11 +0300
committerAndrei Karas <akaras@inbox.ru>2016-06-19 19:19:11 +0300
commit67fd3978786c5f3f66b37fe22d0f7d657de69207 (patch)
tree11a0c80b70910372030e11e01d90fd25e6f73f91
parent6de076ae8cd505511388321757f4bf94c22562b2 (diff)
downloadmanaverse-67fd3978786c5f3f66b37fe22d0f7d657de69207.tar.gz
manaverse-67fd3978786c5f3f66b37fe22d0f7d657de69207.tar.bz2
manaverse-67fd3978786c5f3f66b37fe22d0f7d657de69207.tar.xz
manaverse-67fd3978786c5f3f66b37fe22d0f7d657de69207.zip
Add asserts for missing colors in palettes.
-rw-r--r--src/resources/iteminfo.cpp21
-rw-r--r--src/utils/checkutils.h2
2 files changed, 23 insertions, 0 deletions
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 <ItemColor, ColorDB::ItemColorData>::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 <ItemColor, ColorDB::ItemColorData>::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 <ItemColor, ColorDB::ItemColorData>::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 <ItemColor, ColorDB::ItemColorData>::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) \