diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-09-10 13:19:37 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-09-10 13:19:37 +0300 |
commit | b780f63da855b3ef9374f75d94d980247f4bf2fd (patch) | |
tree | 1029ef4bc8c3842739e4ea9a667959d850f74a23 /src/net/tmwa/beinghandler.cpp | |
parent | dfe0fc16bfbe2f2c36d2adad884c28f89625c285 (diff) | |
download | mv-b780f63da855b3ef9374f75d94d980247f4bf2fd.tar.gz mv-b780f63da855b3ef9374f75d94d980247f4bf2fd.tar.bz2 mv-b780f63da855b3ef9374f75d94d980247f4bf2fd.tar.xz mv-b780f63da855b3ef9374f75d94d980247f4bf2fd.zip |
Improve functions from previous commit.
Diffstat (limited to 'src/net/tmwa/beinghandler.cpp')
-rw-r--r-- | src/net/tmwa/beinghandler.cpp | 70 |
1 files changed, 8 insertions, 62 deletions
diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp index c592c7bf0..70649ac02 100644 --- a/src/net/tmwa/beinghandler.cpp +++ b/src/net/tmwa/beinghandler.cpp @@ -257,44 +257,12 @@ void BeingHandler::processBeingChangeLook(Net::MessageIn &msg) const 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"); - int16_t id = 0; - int id2 = 0; - const bool look2 = msg.getId() == SMSG_BEING_CHANGE_LOOKS2; - - if (!look2) - { - id = static_cast<int16_t>(msg.readUInt8("id")); - id2 = 1; // default color - } - else - { // SMSG_BEING_CHANGE_LOOKS2 - id = msg.readInt16("id1"); - if (type == 2 || serverVersion > 0) - { - id2 = msg.readInt16("id2"); - } - else - { - msg.readInt16("id2"); - id2 = 1; - } - } + const int16_t id = static_cast<int16_t>(msg.readUInt8("id")); + const int id2 = 1; if (!localPlayer || !dstBeing) { @@ -314,43 +282,21 @@ void BeingHandler::processBeingChangeLook2(Net::MessageIn &msg) const 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"); - int16_t id = 0; int id2 = 0; - const bool look2 = msg.getId() == SMSG_BEING_CHANGE_LOOKS2; - if (!look2) + const int16_t id = msg.readInt16("id1"); + if (type == 2 || serverVersion > 0) { - id = static_cast<int16_t>(msg.readUInt8("id")); - id2 = 1; // default color + id2 = msg.readInt16("id2"); } else - { // SMSG_BEING_CHANGE_LOOKS2 - id = msg.readInt16("id1"); - if (type == 2 || serverVersion > 0) - { - id2 = msg.readInt16("id2"); - } - else - { - msg.readInt16("id2"); - id2 = 1; - } + { + msg.readInt16("id2"); + id2 = 1; } if (!localPlayer || !dstBeing) |