summaryrefslogtreecommitdiff
path: root/src/net/eathena
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-10 13:19:37 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-10 13:19:37 +0300
commitb780f63da855b3ef9374f75d94d980247f4bf2fd (patch)
tree1029ef4bc8c3842739e4ea9a667959d850f74a23 /src/net/eathena
parentdfe0fc16bfbe2f2c36d2adad884c28f89625c285 (diff)
downloadplus-b780f63da855b3ef9374f75d94d980247f4bf2fd.tar.gz
plus-b780f63da855b3ef9374f75d94d980247f4bf2fd.tar.bz2
plus-b780f63da855b3ef9374f75d94d980247f4bf2fd.tar.xz
plus-b780f63da855b3ef9374f75d94d980247f4bf2fd.zip
Improve functions from previous commit.
Diffstat (limited to 'src/net/eathena')
-rw-r--r--src/net/eathena/beinghandler.cpp60
1 files changed, 6 insertions, 54 deletions
diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp
index 315d3a47b..649f2fe54 100644
--- a/src/net/eathena/beinghandler.cpp
+++ b/src/net/eathena/beinghandler.cpp
@@ -275,37 +275,12 @@ void BeingHandler::processBeingChangeLook(Net::MessageIn &msg) const
if (!actorManager)
return;
- /*
- * SMSG_BEING_CHANGE_LOOKS (0x00c3) and
- * SMSG_BEING_CHANGE_LOOKS2 (0x01d7) do basically the same
- * thing. The difference is that ...LOOKS carries a single
- * 8 bit value, where ...LOOKS2 carries two 16 bit values.
- *
- * If type = 2, then the first 16 bit value is the weapon ID,
- * and the second 16 bit value is the shield ID. If no
- * shield is equipped, or type is not 2, then the second
- * 16 bit value will be 0.
- */
-
Being *const dstBeing = actorManager->findBeing(
msg.readInt32("being id"));
const uint8_t type = msg.readUInt8("type");
- int id = 0;
- unsigned int id2 = 0U;
- const bool look2 = msg.getId() == SMSG_BEING_CHANGE_LOOKS2;
- if (!look2)
- {
- id = static_cast<int>(msg.readUInt8("id"));
- id2 = 1U; // default color
- }
- else
- { // SMSG_BEING_CHANGE_LOOKS2
- id = msg.readInt16("id1");
- id2 = msg.readInt16("id2");
- if (type != 2)
- id2 = 1;
- }
+ const int id = static_cast<int>(msg.readUInt8("id"));
+ const unsigned int id2 = 1U;
if (!localPlayer || !dstBeing)
return;
@@ -318,37 +293,14 @@ void BeingHandler::processBeingChangeLook2(Net::MessageIn &msg) const
if (!actorManager)
return;
- /*
- * SMSG_BEING_CHANGE_LOOKS (0x00c3) and
- * SMSG_BEING_CHANGE_LOOKS2 (0x01d7) do basically the same
- * thing. The difference is that ...LOOKS carries a single
- * 8 bit value, where ...LOOKS2 carries two 16 bit values.
- *
- * If type = 2, then the first 16 bit value is the weapon ID,
- * and the second 16 bit value is the shield ID. If no
- * shield is equipped, or type is not 2, then the second
- * 16 bit value will be 0.
- */
-
Being *const dstBeing = actorManager->findBeing(
msg.readInt32("being id"));
const uint8_t type = msg.readUInt8("type");
- int id = 0;
- unsigned int id2 = 0U;
- const bool look2 = msg.getId() == SMSG_BEING_CHANGE_LOOKS2;
- if (!look2)
- {
- id = static_cast<int>(msg.readUInt8("id"));
- id2 = 1U; // default color
- }
- else
- { // SMSG_BEING_CHANGE_LOOKS2
- id = msg.readInt16("id1");
- id2 = msg.readInt16("id2");
- if (type != 2)
- id2 = 1;
- }
+ const int id = msg.readInt16("id1");
+ unsigned int id2 = msg.readInt16("id2");
+ if (type != 2)
+ id2 = 1;
if (!localPlayer || !dstBeing)
return;