summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-10 13:56:48 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-10 13:57:45 +0300
commite16fca5b58bbe867b63050e880ba8c156c6fe268 (patch)
tree5690d16b93cf42157384748987c485d2b2c1d43b /src
parentbe02f2d6d4a9afdcd2d46570cbeb97b73cc33526 (diff)
downloadmanaplus-e16fca5b58bbe867b63050e880ba8c156c6fe268.tar.gz
manaplus-e16fca5b58bbe867b63050e880ba8c156c6fe268.tar.bz2
manaplus-e16fca5b58bbe867b63050e880ba8c156c6fe268.tar.xz
manaplus-e16fca5b58bbe867b63050e880ba8c156c6fe268.zip
add function to convert special npc server gender type into client type.
Diffstat (limited to 'src')
-rw-r--r--src/net/eathena/beinghandler.cpp64
-rw-r--r--src/net/eathena/beinghandler.h3
-rw-r--r--src/net/tmwa/beinghandler.cpp51
-rw-r--r--src/net/tmwa/beinghandler.h3
4 files changed, 46 insertions, 75 deletions
diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp
index a178a244b..1a5adcaf9 100644
--- a/src/net/eathena/beinghandler.cpp
+++ b/src/net/eathena/beinghandler.cpp
@@ -1031,21 +1031,7 @@ void BeingHandler::processBeingVisible(Net::MessageIn &msg)
}
else if (dstBeing->getType() == ActorType::NPC)
{
- switch (gender)
- {
- case 2:
- dstBeing->setGender(Gender::FEMALE);
- break;
- case 3:
- dstBeing->setGender(Gender::MALE);
- break;
- case 4:
- dstBeing->setGender(Gender::OTHER);
- break;
- default:
- dstBeing->setGender(Gender::UNSPECIFIED);
- break;
- }
+ setServerGender(dstBeing, gender);
}
uint8_t dir;
@@ -1208,21 +1194,7 @@ void BeingHandler::processBeingMove(Net::MessageIn &msg)
}
else if (dstBeing->getType() == ActorType::NPC)
{
- switch (gender)
- {
- case 2:
- dstBeing->setGender(Gender::FEMALE);
- break;
- case 3:
- dstBeing->setGender(Gender::MALE);
- break;
- case 4:
- dstBeing->setGender(Gender::OTHER);
- break;
- default:
- dstBeing->setGender(Gender::UNSPECIFIED);
- break;
- }
+ setServerGender(dstBeing, gender);
}
uint16_t srcX, srcY, dstX, dstY;
@@ -1387,21 +1359,7 @@ void BeingHandler::processBeingSpawn(Net::MessageIn &msg)
}
else if (dstBeing->getType() == ActorType::NPC)
{
- switch (gender)
- {
- case 2:
- dstBeing->setGender(Gender::FEMALE);
- break;
- case 3:
- dstBeing->setGender(Gender::MALE);
- break;
- case 4:
- dstBeing->setGender(Gender::OTHER);
- break;
- default:
- dstBeing->setGender(Gender::UNSPECIFIED);
- break;
- }
+ setServerGender(dstBeing, gender);
}
uint8_t dir;
@@ -1685,4 +1643,20 @@ void BeingHandler::processBeingChangeDirection(Net::MessageIn &msg) const
BLOCK_END("BeingHandler::processBeingChangeDirection")
}
+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;
+ }
+}
+
} // namespace EAthena
diff --git a/src/net/eathena/beinghandler.h b/src/net/eathena/beinghandler.h
index 3f951870f..3b2760c07 100644
--- a/src/net/eathena/beinghandler.h
+++ b/src/net/eathena/beinghandler.h
@@ -86,6 +86,9 @@ class BeingHandler final : public MessageHandler, public Ea::BeingHandler
const uint8_t type,
const int id,
const int id2) const;
+
+ static void setServerGender(Being *const being,
+ const uint8_t gender);
};
} // namespace EAthena
diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp
index 98081db63..2768cd3e1 100644
--- a/src/net/tmwa/beinghandler.cpp
+++ b/src/net/tmwa/beinghandler.cpp
@@ -1224,21 +1224,7 @@ void BeingHandler::processBeingVisible(Net::MessageIn &msg)
}
else if (dstBeing->getType() == ActorType::NPC)
{
- switch (gender)
- {
- case 2:
- dstBeing->setGender(Gender::FEMALE);
- break;
- case 3:
- dstBeing->setGender(Gender::MALE);
- break;
- case 4:
- dstBeing->setGender(Gender::OTHER);
- break;
- default:
- dstBeing->setGender(Gender::UNSPECIFIED);
- break;
- }
+ setServerGender(dstBeing, gender);
}
uint8_t dir;
@@ -1441,21 +1427,7 @@ void BeingHandler::processBeingMove(Net::MessageIn &msg)
}
else if (dstBeing->getType() == ActorType::NPC)
{
- switch (gender)
- {
- case 2:
- dstBeing->setGender(Gender::FEMALE);
- break;
- case 3:
- dstBeing->setGender(Gender::MALE);
- break;
- case 4:
- dstBeing->setGender(Gender::OTHER);
- break;
- default:
- dstBeing->setGender(Gender::UNSPECIFIED);
- break;
- }
+ setServerGender(dstBeing, gender);
}
uint16_t srcX, srcY, dstX, dstY;
@@ -1594,4 +1566,23 @@ void BeingHandler::processBeingChangeDirection(Net::MessageIn &msg) const
BLOCK_END("BeingHandler::processBeingChangeDirection")
}
+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;
+ case 4:
+ being->setGender(Gender::OTHER);
+ break;
+ default:
+ being->setGender(Gender::UNSPECIFIED);
+ break;
+ }
+}
+
} // namespace TmwAthena
diff --git a/src/net/tmwa/beinghandler.h b/src/net/tmwa/beinghandler.h
index 08e8ae7ca..841f1e14c 100644
--- a/src/net/tmwa/beinghandler.h
+++ b/src/net/tmwa/beinghandler.h
@@ -78,6 +78,9 @@ class BeingHandler final : public MessageHandler, public Ea::BeingHandler
const uint8_t type,
const int id,
const int id2) const;
+
+ static void setServerGender(Being *const being,
+ const uint8_t gender);
};
} // namespace TmwAthena