summaryrefslogtreecommitdiff
path: root/src/being
diff options
context:
space:
mode:
Diffstat (limited to 'src/being')
-rw-r--r--src/being/being.cpp30
-rw-r--r--src/being/being.h10
-rw-r--r--src/being/gender.h15
-rw-r--r--src/being/localplayer.cpp2
4 files changed, 30 insertions, 27 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index c0e325afb..55426913c 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -147,7 +147,7 @@ Being::Being(const int id,
mAttackRange(1),
mLastAttackX(0),
mLastAttackY(0),
- mGender(GENDER_UNSPECIFIED),
+ mGender(Gender::UNSPECIFIED),
mAction(BeingAction::STAND),
mSubType(0xFFFF),
mDirection(BeingDirection::DOWN),
@@ -1802,9 +1802,9 @@ std::string Being::getGenderSign() const
std::string str;
if (mShowGender)
{
- if (getGender() == GENDER_FEMALE)
+ if (getGender() == Gender::FEMALE)
str = "\u2640";
- else if (getGender() == GENDER_MALE)
+ else if (getGender() == Gender::MALE)
str = "\u2642";
}
if (mShowPlayersStatus && mAdvanced)
@@ -2118,7 +2118,7 @@ void Being::load()
// Hairstyles are encoded as negative numbers. Count how far negative
// we can go.
int hairstyles = 1;
- while (ItemDB::get(-hairstyles).getSprite(GENDER_MALE, 0) !=
+ while (ItemDB::get(-hairstyles).getSprite(Gender::MALE, 0) !=
paths.getStringValue("spriteErrorFile"))
{
hairstyles ++;
@@ -2126,7 +2126,7 @@ void Being::load()
mNumberOfHairstyles = hairstyles;
int races = 100;
- while (ItemDB::get(-races).getSprite(GENDER_MALE, 0) !=
+ while (ItemDB::get(-races).getSprite(Gender::MALE, 0) !=
paths.getStringValue("spriteErrorFile"))
{
races ++;
@@ -2275,7 +2275,7 @@ BeingCacheEntry* Being::getCacheEntry(const int id)
}
-void Being::setGender(const Gender gender)
+void Being::setGender(const Gender::Type gender)
{
if (gender != mGender)
{
@@ -3016,32 +3016,32 @@ void Being::updatePercentHP()
}
}
-uint8_t Being::genderToInt(const Gender sex)
+uint8_t Being::genderToInt(const Gender::Type sex)
{
switch (sex)
{
- case GENDER_FEMALE:
- case GENDER_UNSPECIFIED:
+ case Gender::FEMALE:
+ case Gender::UNSPECIFIED:
default:
return 0;
- case GENDER_MALE:
+ case Gender::MALE:
return 1;
- case GENDER_OTHER:
+ case Gender::OTHER:
return 3;
}
}
-Gender Being::intToGender(const uint8_t sex)
+Gender::Type Being::intToGender(const uint8_t sex)
{
switch (sex)
{
case 0:
default:
- return GENDER_FEMALE;
+ return Gender::FEMALE;
case 1:
- return GENDER_MALE;
+ return Gender::MALE;
case 3:
- return GENDER_OTHER;
+ return Gender::OTHER;
}
}
diff --git a/src/being/being.h b/src/being/being.h
index 87949479c..020c97e45 100644
--- a/src/being/being.h
+++ b/src/being/being.h
@@ -599,9 +599,9 @@ class Being : public ActorSprite, public ConfigListener
/**
* Sets the gender of this being.
*/
- virtual void setGender(const Gender gender);
+ virtual void setGender(const Gender::Type gender);
- Gender getGender() const A_WARN_UNUSED
+ Gender::Type getGender() const A_WARN_UNUSED
{ return mGender; }
/**
@@ -858,9 +858,9 @@ class Being : public ActorSprite, public ConfigListener
void setLook(const uint8_t look);
- static uint8_t genderToInt(const Gender sex) A_WARN_UNUSED;
+ static uint8_t genderToInt(const Gender::Type sex) A_WARN_UNUSED;
- static Gender intToGender(const uint8_t sex) A_WARN_UNUSED;
+ static Gender::Type intToGender(const uint8_t sex) A_WARN_UNUSED;
NextSoundInfo mNextSound;
@@ -956,7 +956,7 @@ class Being : public ActorSprite, public ConfigListener
int mAttackRange;
int mLastAttackX;
int mLastAttackY;
- Gender mGender;
+ Gender::Type mGender;
BeingAction::Action mAction;
uint16_t mSubType; /**< Subtype (graphical view, basically) */
uint8_t mDirection; /**< Facing direction */
diff --git a/src/being/gender.h b/src/being/gender.h
index c4d0bd7c7..ed8e759b6 100644
--- a/src/being/gender.h
+++ b/src/being/gender.h
@@ -23,12 +23,15 @@
#ifndef BEING_GENDER_H
#define BEING_GENDER_H
-enum Gender
+namespace Gender
{
- GENDER_MALE = 0,
- GENDER_FEMALE = 1,
- GENDER_UNSPECIFIED = 2,
- GENDER_OTHER = 3
-};
+ enum Type
+ {
+ MALE = 0,
+ FEMALE = 1,
+ UNSPECIFIED = 2,
+ OTHER = 3
+ };
+} // nemespace Gender
#endif // BEING_GENDER_H
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index 29e8eaf03..62eecb9b2 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -964,7 +964,7 @@ void LocalPlayer::handleStatusEffect(const StatusEffect *const effect,
{
mStatusEffectIcons.erase(mStatusEffectIcons.begin() + i);
if (miniStatusWindow)
- miniStatusWindow->eraseIcon(i);
+ miniStatusWindow->eraseIcon(static_cast<int>(i));
}
else
{