From 59dc4ad66d2552ae1809555abd3c1e0faf99209f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 17 May 2013 23:38:30 +0300 Subject: improve palette class. --- src/gui/palette.h | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'src/gui/palette.h') diff --git a/src/gui/palette.h b/src/gui/palette.h index 300df1f45..e842b23a5 100644 --- a/src/gui/palette.h +++ b/src/gui/palette.h @@ -68,9 +68,9 @@ class Palette * @return the requested color or Palette::BLACK */ const gcn::Color &getCharColor(const signed char c, - bool &valid) A_WARN_UNUSED; + bool &valid) const A_WARN_UNUSED; - int getIdByChar(const signed char c, bool &valid) A_WARN_UNUSED; + int getIdByChar(const signed char c, bool &valid) const A_WARN_UNUSED; /** * Gets the color associated with the type. Sets the alpha channel @@ -82,7 +82,7 @@ class Palette * @return the requested color */ inline const gcn::Color &getColor(int type, - int alpha = 255) A_WARN_UNUSED + const int alpha = 255) A_WARN_UNUSED { if (type >= static_cast(mColors.size()) || type < 0) { @@ -95,7 +95,8 @@ class Palette return *col; } - inline const gcn::Color &getColorWithAlpha(int type) A_WARN_UNUSED + inline const gcn::Color &getColorWithAlpha(const int type) + A_WARN_UNUSED { gcn::Color* col = &mColors[type].color; col->a = mColors[type].delay; @@ -119,7 +120,7 @@ class Palette * * @return the color char of the color with the given index */ - inline char getColorChar(int type) const A_WARN_UNUSED + inline char getColorChar(const int type) const A_WARN_UNUSED { return mColors[type].ch; } /** @@ -129,7 +130,7 @@ class Palette * * @return the gradient delay of the color with the given index */ - inline int getGradientDelay(int type) const A_WARN_UNUSED + inline int getGradientDelay(const int type) const A_WARN_UNUSED { return mColors[type].delay; } /** @@ -137,9 +138,6 @@ class Palette */ static void advanceGradients(); - static gcn::Color produceHPColor(int hp, int maxHp, - int alpha = 255) A_WARN_UNUSED; - protected: /** Colors used for the rainbow gradient */ static const gcn::Color RAINBOW_COLORS[]; @@ -211,7 +209,6 @@ class Palette }; typedef std::vector Colors; typedef std::map CharColors; - /** Vector containing the colors. */ Colors mColors; CharColors mCharColors; std::vector mGradVector; -- cgit v1.2.3-70-g09d2