summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2013-10-05 22:15:20 -0700
committerBen Longbons <b.r.longbons@gmail.com>2013-10-10 14:37:49 -0700
commita44741c83773989430f5e3ac4a8a83c93b1341ff (patch)
treef235bfd95ae17d597fda2fedc1ea561358edf23a /src/common
parente591d5b6d891516476aaf12808f4d3b3506e5f92 (diff)
downloadtmwa-a44741c83773989430f5e3ac4a8a83c93b1341ff.tar.gz
tmwa-a44741c83773989430f5e3ac4a8a83c93b1341ff.tar.bz2
tmwa-a44741c83773989430f5e3ac4a8a83c93b1341ff.tar.xz
tmwa-a44741c83773989430f5e3ac4a8a83c93b1341ff.zip
Enumify sex
It's amazing some of this code ever worked ...
Diffstat (limited to 'src/common')
-rw-r--r--src/common/mmo.hpp33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/common/mmo.hpp b/src/common/mmo.hpp
index 0e1a7d0..6dff03a 100644
--- a/src/common/mmo.hpp
+++ b/src/common/mmo.hpp
@@ -267,6 +267,36 @@ enum class ItemLook : uint16_t
DUAL_26 = 0x16,
};
+enum class SEX : uint8_t
+{
+ FEMALE = 0,
+ MALE = 1,
+ SERVER = 2,
+ ERROR,
+};
+inline
+char sex_to_char(SEX sex)
+{
+ switch (sex)
+ {
+ case SEX::FEMALE: return 'F';
+ case SEX::MALE: return 'M';
+ case SEX::SERVER: return 'S';
+ default: return '\0';
+ }
+}
+inline
+SEX sex_from_char(char c)
+{
+ switch (c)
+ {
+ case 'F': return SEX::FEMALE;
+ case 'M': return SEX::MALE;
+ case 'S': return SEX::SERVER;
+ default: return SEX::ERROR;
+ }
+}
+
struct mmo_charstatus
{
int char_id;
@@ -290,7 +320,8 @@ struct mmo_charstatus
CharName name;
unsigned char base_level, job_level;
earray<short, ATTR, ATTR::COUNT> attrs;
- unsigned char char_num, sex;
+ unsigned char char_num;
+ SEX sex;
unsigned long mapip;
unsigned int mapport;