diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-05-31 14:23:11 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-05-31 14:23:11 +0300 |
commit | d7c67fa2b6faa3e81269244224da4b72f045d659 (patch) | |
tree | 596010d034e44ff46eabccca3c77d995626fca88 /src/gui/theme.cpp | |
parent | b072723595e729eed79199f246439ffed62cdbb5 (diff) | |
download | manaverse-d7c67fa2b6faa3e81269244224da4b72f045d659.tar.gz manaverse-d7c67fa2b6faa3e81269244224da4b72f045d659.tar.bz2 manaverse-d7c67fa2b6faa3e81269244224da4b72f045d659.tar.xz manaverse-d7c67fa2b6faa3e81269244224da4b72f045d659.zip |
Convert ProgressColorId enum into strong typed enum.
Diffstat (limited to 'src/gui/theme.cpp')
-rw-r--r-- | src/gui/theme.cpp | 21 |
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; |