diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-09-10 12:28:01 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-09-10 12:28:01 +0300 |
commit | 1a2147b4970a7aab6e610e0cd83ec29a47579e80 (patch) | |
tree | 9d79afaab37e01086ca0bb26677ea704a92f5165 /src/net/tmwa/beinghandler.cpp | |
parent | bc821a0388e887ad8585ea162a1e8e67b691ce56 (diff) | |
download | mv-1a2147b4970a7aab6e610e0cd83ec29a47579e80.tar.gz mv-1a2147b4970a7aab6e610e0cd83ec29a47579e80.tar.bz2 mv-1a2147b4970a7aab6e610e0cd83ec29a47579e80.tar.xz mv-1a2147b4970a7aab6e610e0cd83ec29a47579e80.zip |
Improve functions from previous commit.
Diffstat (limited to 'src/net/tmwa/beinghandler.cpp')
-rw-r--r-- | src/net/tmwa/beinghandler.cpp | 101 |
1 files changed, 23 insertions, 78 deletions
diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp index 6e2dd3ae4..00651e066 100644 --- a/src/net/tmwa/beinghandler.cpp +++ b/src/net/tmwa/beinghandler.cpp @@ -757,7 +757,6 @@ void BeingHandler::processBeingVisible(Net::MessageIn &msg) return; } - const bool visible = msg.getId() == SMSG_BEING_VISIBLE; int spawnId; // Information about a being in range @@ -830,7 +829,7 @@ void BeingHandler::processBeingVisible(Net::MessageIn &msg) { dstBeing->setAction(BeingAction::SPAWN, 0); } - else if (visible) + else { dstBeing->clearPath(); dstBeing->setActionTime(tick_time); @@ -850,9 +849,6 @@ void BeingHandler::processBeingVisible(Net::MessageIn &msg) const uint16_t weapon = msg.readInt16("weapon"); const uint16_t headBottom = msg.readInt16("head bottom"); - if (!visible) - msg.readInt32("tick"); - const uint16_t shield = msg.readInt16("shield"); const uint16_t headTop = msg.readInt16("head top"); const uint16_t headMid = msg.readInt16("head mid"); @@ -940,42 +936,27 @@ void BeingHandler::processBeingVisible(Net::MessageIn &msg) } } - if (!visible) + uint8_t dir; + uint16_t x, y; + msg.readCoordinates(x, y, dir, "position"); + dstBeing->setTileCoords(x, y); + + if (job == 45 && socialWindow && outfitWindow) { - uint16_t srcX, srcY, dstX, dstY; - msg.readCoordinatePair(srcX, srcY, dstX, dstY, "move path"); - if (!disguiseId) + const int num = socialWindow->getPortalIndex(x, y); + if (num >= 0) { - dstBeing->setAction(BeingAction::STAND, 0); - dstBeing->setTileCoords(srcX, srcY); - if (serverVersion < 10) - dstBeing->setDestination(dstX, dstY); + dstBeing->setName(keyboard.getKeyShortString( + outfitWindow->keyName(num))); } - } - else - { - uint8_t dir; - uint16_t x, y; - msg.readCoordinates(x, y, dir, "position"); - dstBeing->setTileCoords(x, y); - - if (job == 45 && socialWindow && outfitWindow) + else { - const int num = socialWindow->getPortalIndex(x, y); - if (num >= 0) - { - dstBeing->setName(keyboard.getKeyShortString( - outfitWindow->keyName(num))); - } - else - { - dstBeing->setName(""); - } + dstBeing->setName(""); } - - dstBeing->setDirection(dir); } + dstBeing->setDirection(dir); + msg.readUInt8("unknown"); msg.readUInt8("unknown"); msg.readUInt8("unknown"); @@ -999,7 +980,6 @@ void BeingHandler::processBeingMove(Net::MessageIn &msg) return; } - const bool visible = msg.getId() == SMSG_BEING_VISIBLE; int spawnId; // Information about a being in range @@ -1069,15 +1049,7 @@ void BeingHandler::processBeingMove(Net::MessageIn &msg) dstBeing->setMoveTime(); if (spawnId) - { dstBeing->setAction(BeingAction::SPAWN, 0); - } - else if (visible) - { - dstBeing->clearPath(); - dstBeing->setActionTime(tick_time); - dstBeing->setAction(BeingAction::STAND, 0); - } // Prevent division by 0 when calculating frame if (speed == 0) @@ -1092,8 +1064,7 @@ void BeingHandler::processBeingMove(Net::MessageIn &msg) const uint16_t weapon = msg.readInt16("weapon"); const uint16_t headBottom = msg.readInt16("head bottom"); - if (!visible) - msg.readInt32("tick"); + msg.readInt32("tick"); const uint16_t shield = msg.readInt16("shield"); const uint16_t headTop = msg.readInt16("head top"); @@ -1182,40 +1153,14 @@ void BeingHandler::processBeingMove(Net::MessageIn &msg) } } - if (!visible) - { - uint16_t srcX, srcY, dstX, dstY; - msg.readCoordinatePair(srcX, srcY, dstX, dstY, "move path"); - if (!disguiseId) - { - dstBeing->setAction(BeingAction::STAND, 0); - dstBeing->setTileCoords(srcX, srcY); - if (serverVersion < 10) - dstBeing->setDestination(dstX, dstY); - } - } - else + uint16_t srcX, srcY, dstX, dstY; + msg.readCoordinatePair(srcX, srcY, dstX, dstY, "move path"); + if (!disguiseId) { - uint8_t dir; - uint16_t x, y; - msg.readCoordinates(x, y, dir, "position"); - dstBeing->setTileCoords(x, y); - - if (job == 45 && socialWindow && outfitWindow) - { - const int num = socialWindow->getPortalIndex(x, y); - if (num >= 0) - { - dstBeing->setName(keyboard.getKeyShortString( - outfitWindow->keyName(num))); - } - else - { - dstBeing->setName(""); - } - } - - dstBeing->setDirection(dir); + dstBeing->setAction(BeingAction::STAND, 0); + dstBeing->setTileCoords(srcX, srcY); + if (serverVersion < 10) + dstBeing->setDestination(dstX, dstY); } msg.readUInt8("unknown"); |