summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-09-28 22:54:47 +0200
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-09-28 22:54:47 +0200
commit7c2a0d292b3c39a7947563c1fc1df50423bf2a8f (patch)
tree4036bd5fe6af69931062df4ab2eab4a1c6d9ade6 /src
parent2a57ef8fb0e95709b0758ce4b9fa8aff62f811fd (diff)
downloadmanaserv-7c2a0d292b3c39a7947563c1fc1df50423bf2a8f.tar.gz
manaserv-7c2a0d292b3c39a7947563c1fc1df50423bf2a8f.tar.bz2
manaserv-7c2a0d292b3c39a7947563c1fc1df50423bf2a8f.tar.xz
manaserv-7c2a0d292b3c39a7947563c1fc1df50423bf2a8f.zip
Officially added the being gender to the protocol.
Diffstat (limited to 'src')
-rw-r--r--src/common/manaserv_protocol.h12
-rw-r--r--src/game-server/character.cpp15
-rw-r--r--src/game-server/character.h7
3 files changed, 29 insertions, 5 deletions
diff --git a/src/common/manaserv_protocol.h b/src/common/manaserv_protocol.h
index 532eff6f..5bcfeb66 100644
--- a/src/common/manaserv_protocol.h
+++ b/src/common/manaserv_protocol.h
@@ -431,6 +431,18 @@ enum BeingDirection
RIGHT = 8
};
+/**
+ * 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 ef001638..0cac8cfa 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,19 @@ void Character::cancelTransaction()
}
}
+void Character::setGender(int gender)
+{
+ switch (gender)
+ {
+ case GENDER_MALE:
+ case GENDER_FEMALE:
+ mGender = (BeingGender)gender;
+ 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 83445916..30e39633 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. */