summaryrefslogtreecommitdiff
path: root/src/net/ea
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-03-14 03:56:02 +0300
committerAndrei Karas <akaras@inbox.ru>2012-03-14 04:06:13 +0300
commit112d2ad1904051160822d1845d1418cca889c0d5 (patch)
tree9731934d9dc367f931c028158f3d26a670e18feb /src/net/ea
parent02e9a62ce9a0f288804bfa2aa59c3a84b0376c4a (diff)
downloadmanaplus-112d2ad1904051160822d1845d1418cca889c0d5.tar.gz
manaplus-112d2ad1904051160822d1845d1418cca889c0d5.tar.bz2
manaplus-112d2ad1904051160822d1845d1418cca889c0d5.tar.xz
manaplus-112d2ad1904051160822d1845d1418cca889c0d5.zip
Add support for other gender.
Fix per gender and race items separation.
Diffstat (limited to 'src/net/ea')
-rw-r--r--src/net/ea/beinghandler.cpp8
-rw-r--r--src/net/ea/guildhandler.cpp8
-rw-r--r--src/net/ea/loginhandler.cpp18
3 files changed, 22 insertions, 12 deletions
diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp
index f1d608717..f669163be 100644
--- a/src/net/ea/beinghandler.cpp
+++ b/src/net/ea/beinghandler.cpp
@@ -259,8 +259,8 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg, bool visible)
if (dstBeing->getType() == ActorSprite::PLAYER)
{
- gender &= 1;
- dstBeing->setGender((gender == 0) ? GENDER_FEMALE : GENDER_MALE);
+ gender &= 3;
+ dstBeing->setGender(Being::intToGender(gender));
// Set these after the gender, as the sprites may be gender-specific
setSprite(dstBeing, EA_SPRITE_HAIR, hairStyle * -1,
ColorDB::getHairColor(hairColor));
@@ -283,13 +283,15 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg, bool visible)
case 3:
dstBeing->setGender(GENDER_MALE);
break;
+ case 4:
+ dstBeing->setGender(GENDER_OTHER);
+ break;
default:
dstBeing->setGender(GENDER_UNSPECIFIED);
break;
}
}
-
if (!visible)
{
Uint16 srcX, srcY, dstX, dstY;
diff --git a/src/net/ea/guildhandler.cpp b/src/net/ea/guildhandler.cpp
index 96a361838..950f26b03 100644
--- a/src/net/ea/guildhandler.cpp
+++ b/src/net/ea/guildhandler.cpp
@@ -251,13 +251,7 @@ void GuildHandler::processGuildMemberList(Net::MessageIn &msg)
m->setOnline(online);
m->setID(id);
m->setCharId(charId);
- if (!gender)
- m->setGender(GENDER_FEMALE);
- else if (gender == 1)
- m->setGender(GENDER_MALE);
- else
- m->setGender(GENDER_UNSPECIFIED);
-
+ m->setGender(Being::intToGender(gender));
m->setLevel(level);
m->setExp(exp);
m->setPos(pos);
diff --git a/src/net/ea/loginhandler.cpp b/src/net/ea/loginhandler.cpp
index 560893a4f..d35e5a0d5 100644
--- a/src/net/ea/loginhandler.cpp
+++ b/src/net/ea/loginhandler.cpp
@@ -97,7 +97,21 @@ void LoginHandler::registerAccount(LoginData *loginData)
return;
std::string username = loginData->username;
- username.append((loginData->gender == GENDER_FEMALE) ? "_F" : "_M");
+ switch (loginData->gender)
+ {
+ case GENDER_FEMALE:
+ username.append("_F");
+ break;
+ case GENDER_MALE:
+ username.append("_M");
+ break;
+ case GENDER_OTHER:
+ username.append("_O");
+ break;
+ case GENDER_UNSPECIFIED:
+ default:
+ break;
+ }
sendLoginRegister(username, loginData->password);
}
@@ -181,7 +195,7 @@ void LoginHandler::processLoginData(Net::MessageIn &msg)
// msg.skip(30); // unknown
// reserve bits for future usage
- mToken.sex = (msg.readInt8() & 1) ? GENDER_MALE : GENDER_FEMALE;
+ mToken.sex = Being::intToGender(msg.readInt8() & 3);
for (int i = 0; i < worldCount; i++)
{