From 16f6f636aee6acaf52439643502f5ff9cb4ccffc Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 1 Jun 2015 01:08:30 +0300 Subject: Convert UserColorId enum into strong typed enum. --- src/being/being.cpp | 23 +++++++++++++++++------ src/being/being.h | 14 +++++++++++--- src/being/localplayer.cpp | 2 +- src/being/localplayer.h | 5 +++-- 4 files changed, 32 insertions(+), 12 deletions(-) (limited to 'src/being') diff --git a/src/being/being.cpp b/src/being/being.cpp index e30a1e477..3503b5259 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -2594,11 +2594,16 @@ void Being::drawSpriteAt(Graphics *const graphics, if (!maxHP) maxHP = mInfo->getMaxHP(); - drawHpBar(graphics, maxHP, mHP, mDamageTaken, - UserColorId::MONSTER_HP, UserColorId::MONSTER_HP2, + drawHpBar(graphics, + maxHP, + mHP, + mDamageTaken, + UserColorId::MONSTER_HP, + UserColorId::MONSTER_HP2, x - 50 + mapTileSize / 2 + mInfo->getHpBarOffsetX(), y + mapTileSize - 6 + mInfo->getHpBarOffsetY(), - 2 * 50, 4); + 2 * 50, + 4); } if (mShowOwnHP && mInfo @@ -2614,9 +2619,15 @@ void Being::drawSpriteAt(Graphics *const graphics, } } -void Being::drawHpBar(Graphics *const graphics, const int maxHP, const int hp, - const int damage, const int color1, const int color2, - const int x, const int y, const int width, +void Being::drawHpBar(Graphics *const graphics, + const int maxHP, + const int hp, + const int damage, + const UserColorIdT color1, + const UserColorIdT color2, + const int x, + const int y, + const int width, const int height) const { if (maxHP <= 0 || !userPalette) diff --git a/src/being/being.h b/src/being/being.h index 6e8588213..ebce57c41 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -25,6 +25,8 @@ #include "enums/being/reachable.h" +#include "enums/gui/usercolorid.h" + #include "enums/simpletypes/move.h" #include "resources/beinginfo.h" @@ -533,9 +535,15 @@ class Being notfinal : public ActorSprite, virtual void drawSpritesSDL(Graphics *const graphics, int posX, int posY) const override final; - void drawHpBar(Graphics *const graphics, const int x, const int y, - const int maxHP, const int hp, const int damage, - const int color1, const int color2, const int width, + void drawHpBar(Graphics *const graphics, + const int maxHP, + const int hp, + const int damage, + const UserColorIdT color1, + const UserColorIdT color2, + const int x, + const int y, + const int width, const int height) const; static void load(); diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index a941dc42c..7eea9c18a 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -1025,7 +1025,7 @@ void LocalPlayer::handleStatusEffect(const StatusEffect *const effect, } void LocalPlayer::addMessageToQueue(const std::string &message, - const int color) + const UserColorIdT color) { if (mMessages.size() < 20) mMessages.push_back(MessagePair(message, color)); diff --git a/src/being/localplayer.h b/src/being/localplayer.h index e5ae09ae9..2425f7502 100644 --- a/src/being/localplayer.h +++ b/src/being/localplayer.h @@ -280,7 +280,8 @@ class LocalPlayer final : public Being, void setMap(Map *const map) override final; void addMessageToQueue(const std::string &message, - const int color = UserColorId::EXP_INFO); + const UserColorIdT color + = UserColorId::EXP_INFO); /** * Called when a option (set with config.addListener()) is changed @@ -458,7 +459,7 @@ class LocalPlayer final : public Being, std::vector mStatusEffectIcons; - typedef std::pair MessagePair; + typedef std::pair MessagePair; /** Queued messages*/ std::list mMessages; int mMessageTime; -- cgit v1.2.3-60-g2f50