summaryrefslogtreecommitdiff
path: root/src/gui/palette.h
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-05-17 23:38:30 +0300
committerAndrei Karas <akaras@inbox.ru>2013-05-17 23:38:30 +0300
commit59dc4ad66d2552ae1809555abd3c1e0faf99209f (patch)
tree3601d11524a489ec47ce5847a3a8d20e72032751 /src/gui/palette.h
parent3ba28f181216a150b3a59d912a8bbd9f8392f901 (diff)
downloadmanaverse-59dc4ad66d2552ae1809555abd3c1e0faf99209f.tar.gz
manaverse-59dc4ad66d2552ae1809555abd3c1e0faf99209f.tar.bz2
manaverse-59dc4ad66d2552ae1809555abd3c1e0faf99209f.tar.xz
manaverse-59dc4ad66d2552ae1809555abd3c1e0faf99209f.zip
improve palette class.
Diffstat (limited to 'src/gui/palette.h')
-rw-r--r--src/gui/palette.h17
1 files changed, 7 insertions, 10 deletions
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<signed>(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<ColorElem> Colors;
typedef std::map<unsigned char, int> CharColors;
- /** Vector containing the colors. */
Colors mColors;
CharColors mCharColors;
std::vector<ColorElem*> mGradVector;