summaryrefslogtreecommitdiff
path: root/src/gui/theme.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-05-31 14:23:11 +0300
committerAndrei Karas <akaras@inbox.ru>2015-05-31 14:23:11 +0300
commitd7c67fa2b6faa3e81269244224da4b72f045d659 (patch)
tree596010d034e44ff46eabccca3c77d995626fca88 /src/gui/theme.cpp
parentb072723595e729eed79199f246439ffed62cdbb5 (diff)
downloadmanaplus-d7c67fa2b6faa3e81269244224da4b72f045d659.tar.gz
manaplus-d7c67fa2b6faa3e81269244224da4b72f045d659.tar.bz2
manaplus-d7c67fa2b6faa3e81269244224da4b72f045d659.tar.xz
manaplus-d7c67fa2b6faa3e81269244224da4b72f045d659.zip
Convert ProgressColorId enum into strong typed enum.
Diffstat (limited to 'src/gui/theme.cpp')
-rw-r--r--src/gui/theme.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp
index d9740de3b..7a6a49d45 100644
--- a/src/gui/theme.cpp
+++ b/src/gui/theme.cpp
@@ -73,7 +73,8 @@ Theme::Theme() :
Palette(ThemeColorId::THEME_COLORS_END * THEME_PALETTES),
mSkins(),
mMinimumOpacity(-1.0F),
- mProgressColors(ProgressColors(ProgressColorId::THEME_PROG_END))
+ mProgressColors(ProgressColors(static_cast<size_t>(
+ ProgressColorId::THEME_PROG_END)))
{
initDefaultThemePath();
@@ -139,18 +140,25 @@ Theme::~Theme()
delete_all(mProgressColors);
}
-Color Theme::getProgressColor(const int type, const float progress)
+Color Theme::getProgressColor(const ProgressColorIdT type,
+ const float progress)
{
int color[3] = {0, 0, 0};
if (theme)
{
- const DyePalette *const dye = theme->mProgressColors[type];
+ const DyePalette *const dye
+ = theme->mProgressColors[static_cast<size_t>(type)];
if (dye)
+ {
dye->getColor(progress, color);
+ }
else
- logger->log("color not found: " + toString(type));
+ {
+ logger->log("color not found: "
+ + toString(static_cast<int>(type)));
+ }
}
return Color(color[0], color[1], color[2]);
@@ -937,7 +945,8 @@ static GradientTypeT readColorGradient(const std::string &grad)
static int readProgressType(const std::string &type)
{
- static const std::string colors[ProgressColorId::THEME_PROG_END] =
+ static const std::string colors[static_cast<size_t>(
+ ProgressColorId::THEME_PROG_END)] =
{
"HP",
"HP_POISON",
@@ -956,7 +965,7 @@ static int readProgressType(const std::string &type)
if (type.empty())
return -1;
- for (int i = 0; i < ProgressColorId::THEME_PROG_END; i++)
+ for (int i = 0; i < static_cast<int>(ProgressColorId::THEME_PROG_END); i++)
{
if (compareStrI(type, colors[i]) == 0)
return i;