diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-11-28 22:26:47 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-11-28 22:26:47 +0300 |
commit | 827bbb15f7a4cc5483b1d0dddb3e40fd208b8880 (patch) | |
tree | dc069a07050ecc005ab98771c9af366c178694ae /src | |
parent | ad97c3b32b98564b8288152f493e9c29c25e9326 (diff) | |
download | manaplus-827bbb15f7a4cc5483b1d0dddb3e40fd208b8880.tar.gz manaplus-827bbb15f7a4cc5483b1d0dddb3e40fd208b8880.tar.bz2 manaplus-827bbb15f7a4cc5483b1d0dddb3e40fd208b8880.tar.xz manaplus-827bbb15f7a4cc5483b1d0dddb3e40fd208b8880.zip |
eathena: show npc gender based on normal sex id.
Diffstat (limited to 'src')
-rw-r--r-- | src/net/eathena/beinghandler.cpp | 31 | ||||
-rw-r--r-- | src/net/eathena/beinghandler.h | 3 |
2 files changed, 6 insertions, 28 deletions
diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp index d321adc91..7736c5298 100644 --- a/src/net/eathena/beinghandler.cpp +++ b/src/net/eathena/beinghandler.cpp @@ -1034,11 +1034,10 @@ void BeingHandler::processBeingVisible(Net::MessageIn &msg) dstBeing->setStatusEffectBlock(32, static_cast<uint16_t>( msg.readInt32("opt3"))); dstBeing->setKarma(msg.readUInt8("karma")); - uint8_t gender = msg.readUInt8("gender"); + uint8_t gender = msg.readUInt8("gender") & 3; if (dstBeing->getType() == ActorType::Player) { - gender &= 3; dstBeing->setGender(Being::intToGender(gender)); // Set these after the gender, as the sprites may be gender-specific setSprite(dstBeing, SPRITE_HAIR, hairStyle * -1, @@ -1054,7 +1053,7 @@ void BeingHandler::processBeingVisible(Net::MessageIn &msg) } else if (dstBeing->getType() == ActorType::Npc) { - setServerGender(dstBeing, gender); + dstBeing->setGender(Being::intToGender(gender)); } uint8_t dir; @@ -1199,11 +1198,10 @@ void BeingHandler::processBeingMove(Net::MessageIn &msg) dstBeing->setStatusEffectBlock(32, static_cast<uint16_t>( msg.readInt32("opt3"))); dstBeing->setKarma(msg.readUInt8("karma")); - uint8_t gender = msg.readUInt8("gender"); + uint8_t gender = msg.readUInt8("gender") & 3; if (dstBeing->getType() == ActorType::Player) { - gender &= 3; dstBeing->setGender(Being::intToGender(gender)); // Set these after the gender, as the sprites may be gender-specific setSprite(dstBeing, SPRITE_HAIR, hairStyle * -1, @@ -1219,7 +1217,7 @@ void BeingHandler::processBeingMove(Net::MessageIn &msg) } else if (dstBeing->getType() == ActorType::Npc) { - setServerGender(dstBeing, gender); + dstBeing->setGender(Being::intToGender(gender)); } uint16_t srcX, srcY, dstX, dstY; @@ -1366,11 +1364,10 @@ void BeingHandler::processBeingSpawn(Net::MessageIn &msg) dstBeing->setStatusEffectBlock(32, static_cast<uint16_t>( msg.readInt32("opt3"))); dstBeing->setKarma(msg.readUInt8("karma")); - uint8_t gender = msg.readUInt8("gender"); + uint8_t gender = msg.readUInt8("gender") & 3; if (dstBeing->getType() == ActorType::Player) { - gender &= 3; dstBeing->setGender(Being::intToGender(gender)); // Set these after the gender, as the sprites may be gender-specific setSprite(dstBeing, SPRITE_HAIR, hairStyle * -1, @@ -1386,7 +1383,7 @@ void BeingHandler::processBeingSpawn(Net::MessageIn &msg) } else if (dstBeing->getType() == ActorType::Npc) { - setServerGender(dstBeing, gender); + dstBeing->setGender(Being::intToGender(gender)); } uint8_t dir; @@ -1726,22 +1723,6 @@ void BeingHandler::processBeingSoundEffect(Net::MessageIn &msg) msg.readInt32("source being id"); } -void BeingHandler::setServerGender(Being *const being, const uint8_t gender) -{ - switch (gender) - { - case 2: - being->setGender(Gender::FEMALE); - break; - case 3: - being->setGender(Gender::MALE); - break; - default: - being->setGender(Gender::UNSPECIFIED); - break; - } -} - void BeingHandler::applyPlayerAction(Being *const being, const uint8_t type) { switch (type) diff --git a/src/net/eathena/beinghandler.h b/src/net/eathena/beinghandler.h index 00041bd9d..cafe2457f 100644 --- a/src/net/eathena/beinghandler.h +++ b/src/net/eathena/beinghandler.h @@ -98,9 +98,6 @@ class BeingHandler final : public MessageHandler, public Ea::BeingHandler static void processBeingSoundEffect(Net::MessageIn &msg); - static void setServerGender(Being *const being, - const uint8_t gender); - static void applyPlayerAction(Being *const being, const uint8_t type); |