summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scripts/lua/libmana-constants.lua1
-rw-r--r--src/common/manaserv_protocol.h14
-rw-r--r--src/game-server/character.cpp17
-rw-r--r--src/game-server/character.h7
4 files changed, 33 insertions, 6 deletions
diff --git a/scripts/lua/libmana-constants.lua b/scripts/lua/libmana-constants.lua
index 912216c..08d26c5 100644
--- a/scripts/lua/libmana-constants.lua
+++ b/scripts/lua/libmana-constants.lua
@@ -39,6 +39,7 @@ DIRECTION_RIGHT = 8;
GENDER_MALE = 0;
GENDER_FEMALE = 1;
+GENDER_UNSPECIFIED = 2;
DAMAGE_PHYSICAL = 0;
DAMAGE_MAGICAL = 1;
diff --git a/src/common/manaserv_protocol.h b/src/common/manaserv_protocol.h
index dc7e47b..cbe7a0b 100644
--- a/src/common/manaserv_protocol.h
+++ b/src/common/manaserv_protocol.h
@@ -165,7 +165,7 @@ enum {
GPMSG_BEINGS_DAMAGE = 0x0310, // { W being id, W amount }*
GPMSG_CREATE_EFFECT_POS = 0x0320, // W effect id, W*2 position
GPMSG_CREATE_EFFECT_BEING = 0x0321, // W effect id, W BeingID
- GPMSG_SHAKE = 0x0330, // W intensityX, W intensityY, [W decay_times_10000, [W duration]]
+ GPMSG_SHAKE = 0x0330, // W intensityX, W intensityY, [W decay_times_10000, [W duration]]
// Guild
PCMSG_GUILD_CREATE = 0x0350, // S name
@@ -443,6 +443,18 @@ enum SpriteLayer
SPRITE_VECTOREND
};
+/**
+ * Beings Genders
+ * WARNING: Has to be in sync with the same enum in the Being class
+ * of the client!
+ */
+enum BeingGender
+{
+ GENDER_MALE = 0,
+ GENDER_FEMALE,
+ GENDER_UNSPECIFIED
+};
+
} // namespace ManaServ
#endif // MANASERV_PROTOCOL_H
diff --git a/src/game-server/character.cpp b/src/game-server/character.cpp
index ef00163..d3cc20b 100644
--- a/src/game-server/character.cpp
+++ b/src/game-server/character.cpp
@@ -58,7 +58,7 @@ Character::Character(MessageIn &msg):
mRechargePerSpecial(0),
mSpecialUpdateNeeded(false),
mDatabaseID(-1),
- mGender(0),
+ mGender(GENDER_UNSPECIFIED),
mHairStyle(0),
mHairColor(0),
mLevel(1),
@@ -295,6 +295,21 @@ void Character::cancelTransaction()
}
}
+void Character::setGender(int gender)
+{
+ switch (gender)
+ {
+ case 0:
+ mGender = GENDER_MALE;
+ break;
+ case 1:
+ mGender = GENDER_FEMALE;
+ break;
+ default:
+ mGender = GENDER_UNSPECIFIED;
+ }
+}
+
Trade *Character::getTrading() const
{
return mTransaction == TRANS_TRADE
diff --git a/src/game-server/character.h b/src/game-server/character.h
index 8344591..30e3963 100644
--- a/src/game-server/character.h
+++ b/src/game-server/character.h
@@ -174,12 +174,11 @@ class Character : public Being
void setDatabaseID(int id) { mDatabaseID = id; }
/** Gets the gender of the character (male or female). */
- int getGender() const
+ BeingGender getGender() const
{ return mGender; }
/** Sets the gender of the character (male or female). */
- void setGender(int gender)
- { mGender = gender; }
+ void setGender(int gender);
int getHairStyle() const { return mHairStyle; }
void setHairStyle(int style) { mHairStyle = style; }
@@ -443,7 +442,7 @@ class Character : public Being
bool mSpecialUpdateNeeded;
int mDatabaseID; /**< Character's database ID. */
- unsigned char mGender; /**< Gender of the character. */
+ BeingGender mGender; /**< Gender of the character. */
unsigned char mHairStyle; /**< Hair Style of the character. */
unsigned char mHairColor; /**< Hair Color of the character. */
int mLevel; /**< Level of the character. */