summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-12-29 17:57:13 +0300
committerAndrei Karas <akaras@inbox.ru>2016-12-29 17:57:13 +0300
commit30c8e376a1c45043863e6ad8b04186eabb711487 (patch)
tree25acbe8618de339638c3735193ed9b15ff740536
parent11f9e4c95d1e30005240f6e00204faa93bb315db (diff)
downloadmv-30c8e376a1c45043863e6ad8b04186eabb711487.tar.gz
mv-30c8e376a1c45043863e6ad8b04186eabb711487.tar.bz2
mv-30c8e376a1c45043863e6ad8b04186eabb711487.tar.xz
mv-30c8e376a1c45043863e6ad8b04186eabb711487.zip
Add constexpr into being.
-rw-r--r--src/being/being.cpp29
-rw-r--r--src/being/being.h31
2 files changed, 29 insertions, 31 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index fa009fc6d..b71a0be92 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -4687,35 +4687,6 @@ void Being::updatePercentHP() restrict2
BLOCK_END("Being::updatePercentHP")
}
-uint8_t Being::genderToInt(const GenderT sex)
-{
- switch (sex)
- {
- case Gender::FEMALE:
- case Gender::UNSPECIFIED:
- default:
- return 0;
- case Gender::MALE:
- return 1;
- case Gender::OTHER:
- return 3;
- }
-}
-
-GenderT Being::intToGender(const uint8_t sex)
-{
- switch (sex)
- {
- case 0:
- default:
- return Gender::FEMALE;
- case 1:
- return Gender::MALE;
- case 3:
- return Gender::OTHER;
- }
-}
-
int Being::getSpriteID(const int slot) const restrict2
{
if (slot < 0 || CAST_SIZE(slot) >= mSlots.size())
diff --git a/src/being/being.h b/src/being/being.h
index b35c550bd..121618880 100644
--- a/src/being/being.h
+++ b/src/being/being.h
@@ -908,9 +908,36 @@ class Being notfinal : public ActorSprite,
void setLook(const uint16_t look) restrict2;
- static uint8_t genderToInt(const GenderT sex) A_CONST A_WARN_UNUSED;
+ constexpr2 static uint8_t genderToInt(const GenderT sex)
+ A_CONST A_WARN_UNUSED
+ {
+ switch (sex)
+ {
+ case Gender::FEMALE:
+ case Gender::UNSPECIFIED:
+ default:
+ return 0;
+ case Gender::MALE:
+ return 1;
+ case Gender::OTHER:
+ return 3;
+ }
+ }
- static GenderT intToGender(const uint8_t sex) A_CONST A_WARN_UNUSED;
+ constexpr2 static GenderT intToGender(const uint8_t sex)
+ A_CONST A_WARN_UNUSED
+ {
+ switch (sex)
+ {
+ case 0:
+ default:
+ return Gender::FEMALE;
+ case 1:
+ return Gender::MALE;
+ case 3:
+ return Gender::OTHER;
+ }
+ }
NextSoundInfo mNextSound;