diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/net/manaserv/beinghandler.cpp | 13 | ||||
-rw-r--r-- | src/net/manaserv/manaserv_protocol.h | 8 |
2 files changed, 13 insertions, 8 deletions
diff --git a/src/net/manaserv/beinghandler.cpp b/src/net/manaserv/beinghandler.cpp index b744e53c..52f6dab4 100644 --- a/src/net/manaserv/beinghandler.cpp +++ b/src/net/manaserv/beinghandler.cpp @@ -117,6 +117,14 @@ void BeingHandler::handleBeingEnterMessage(MessageIn &msg) int px = msg.readInt16(); int py = msg.readInt16(); BeingDirection direction = (BeingDirection)msg.readInt8(); + Gender gender; + int genderAsInt = msg.readInt8(); + if (genderAsInt == ::GENDER_FEMALE) + gender = ::GENDER_FEMALE; + else if (genderAsInt == ::GENDER_MALE) + gender = ::GENDER_MALE; + else + gender = ::GENDER_UNSPECIFIED; Being *being; switch (type) @@ -138,8 +146,6 @@ void BeingHandler::handleBeingEnterMessage(MessageIn &msg) int hs = msg.readInt8(), hc = msg.readInt8(); being->setSprite(SPRITE_LAYER_HAIR, hs * -1, hairDB.getHairColor(hc)); - being->setGender(msg.readInt8() == ManaServ::GENDER_MALE ? - ::GENDER_MALE : ::GENDER_FEMALE); handleLooks(being, msg); } break; @@ -151,8 +157,6 @@ void BeingHandler::handleBeingEnterMessage(MessageIn &msg) ? ActorSprite::MONSTER : ActorSprite::NPC, subtype); std::string name = msg.readString(); if (name.length() > 0) being->setName(name); - being->setGender(msg.readInt8() == ManaServ::GENDER_MALE ? - ::GENDER_MALE : ::GENDER_FEMALE); } break; default: @@ -163,6 +167,7 @@ void BeingHandler::handleBeingEnterMessage(MessageIn &msg) being->setDestination(px, py); being->setDirection(direction); being->setAction(action); + being->setGender(gender); } void BeingHandler::handleBeingLeaveMessage(MessageIn &msg) diff --git a/src/net/manaserv/manaserv_protocol.h b/src/net/manaserv/manaserv_protocol.h index 0cc4524c..319d7070 100644 --- a/src/net/manaserv/manaserv_protocol.h +++ b/src/net/manaserv/manaserv_protocol.h @@ -122,10 +122,10 @@ enum { PGMSG_LOWER_ATTRIBUTE = 0x0170, // W attribute GPMSG_LOWER_ATTRIBUTE_RESPONSE = 0x0171, // B error, W attribute PGMSG_RESPAWN = 0x0180, // - - GPMSG_BEING_ENTER = 0x0200, // B type, W being id, B action, W*2 position, B direction - // character: S name, B hair style, B hair color, B gender, B sprite layers changed, { B slot type, W item id }* - // monster: W type id gender - // npc: W type id gender + GPMSG_BEING_ENTER = 0x0200, // B type, W being id, B action, W*2 position, B direction, B gender + // character: S name, B hair style, B hair color, B sprite layers changed, { B slot type, W item id }* + // monster: W type id + // npc: W type id GPMSG_BEING_LEAVE = 0x0201, // W being id GPMSG_ITEM_APPEAR = 0x0202, // W item id, W*2 position GPMSG_BEING_LOOKS_CHANGE = 0x0210, // B sprite layers changed, { B slot type, W item id }* |