diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-09-10 13:02:49 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-09-10 13:02:49 +0300 |
commit | 173c48498dc55e9b86bee009427fb5ae58cd9821 (patch) | |
tree | f9bbddb6e0f5cdf26cbd64a1e1aa76e482b4ce0f /src/net/tmwa/beinghandler.cpp | |
parent | 1a2147b4970a7aab6e610e0cd83ec29a47579e80 (diff) | |
download | mv-173c48498dc55e9b86bee009427fb5ae58cd9821.tar.gz mv-173c48498dc55e9b86bee009427fb5ae58cd9821.tar.bz2 mv-173c48498dc55e9b86bee009427fb5ae58cd9821.tar.xz mv-173c48498dc55e9b86bee009427fb5ae58cd9821.zip |
Split processBeingChangeLook into tow functions with net code and without.
Diffstat (limited to 'src/net/tmwa/beinghandler.cpp')
-rw-r--r-- | src/net/tmwa/beinghandler.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp index 00651e066..5338cd4c3 100644 --- a/src/net/tmwa/beinghandler.cpp +++ b/src/net/tmwa/beinghandler.cpp @@ -268,16 +268,10 @@ void BeingHandler::processBeingChangeLook(Net::MessageIn &msg) const Being *const dstBeing = actorManager->findBeing( msg.readInt32("being id")); - if (!dstBeing) - { - BLOCK_END("BeingHandler::processBeingChangeLook") - return; - } const uint8_t type = msg.readUInt8("type"); int16_t id = 0; int id2 = 0; - const std::string color; const bool look2 = msg.getId() == SMSG_BEING_CHANGE_LOOKS2; if (!look2) @@ -299,15 +293,24 @@ void BeingHandler::processBeingChangeLook(Net::MessageIn &msg) const } } - if (dstBeing->getType() == ActorType::PLAYER) - dstBeing->setOtherTime(); - - if (!localPlayer) + if (!localPlayer || !dstBeing) { BLOCK_END("BeingHandler::processBeingChangeLook") return; } + processBeingChangeLookContinue(dstBeing, type, id, id2); + BLOCK_END("BeingHandler::processBeingChangeLook") +} + +void BeingHandler::processBeingChangeLookContinue(Being *const dstBeing, + const uint8_t type, + const int id, + const int id2) const +{ + if (dstBeing->getType() == ActorType::PLAYER) + dstBeing->setOtherTime(); + const std::string color; switch (type) { case 0: // change race @@ -402,7 +405,6 @@ void BeingHandler::processBeingChangeLook(Net::MessageIn &msg) const logger->log("name: " + toString(dstBeing->getName())); break; } - BLOCK_END("BeingHandler::processBeingChangeLook") } void BeingHandler::processNameResponse2(Net::MessageIn &msg) |