summaryrefslogtreecommitdiff
path: root/src/being
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-06-01 01:08:30 +0300
committerAndrei Karas <akaras@inbox.ru>2015-06-01 01:08:30 +0300
commit16f6f636aee6acaf52439643502f5ff9cb4ccffc (patch)
tree9f291e5257e20b0090405d4594553f38a69767ce /src/being
parent3fc7fd8473e545265c705504ee0d5f2a70268282 (diff)
downloadManaVerse-16f6f636aee6acaf52439643502f5ff9cb4ccffc.tar.gz
ManaVerse-16f6f636aee6acaf52439643502f5ff9cb4ccffc.tar.bz2
ManaVerse-16f6f636aee6acaf52439643502f5ff9cb4ccffc.tar.xz
ManaVerse-16f6f636aee6acaf52439643502f5ff9cb4ccffc.zip
Convert UserColorId enum into strong typed enum.
Diffstat (limited to 'src/being')
-rw-r--r--src/being/being.cpp23
-rw-r--r--src/being/being.h14
-rw-r--r--src/being/localplayer.cpp2
-rw-r--r--src/being/localplayer.h5
4 files changed, 32 insertions, 12 deletions
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<int> mStatusEffectIcons;
- typedef std::pair<std::string, int> MessagePair;
+ typedef std::pair<std::string, UserColorIdT> MessagePair;
/** Queued messages*/
std::list<MessagePair> mMessages;
int mMessageTime;