diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-09-05 01:11:42 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-09-06 01:18:57 +0300 |
commit | 2549b4753c78726677583d046fc8841c8f3e3577 (patch) | |
tree | de419fee17b1dcac0523668c1edc7569b18d4b78 /src/net/eathena/beinghandler.cpp | |
parent | 8f8a9d2f1791754a1376ba9c7f010ee47d091598 (diff) | |
download | manaplus-2549b4753c78726677583d046fc8841c8f3e3577.tar.gz manaplus-2549b4753c78726677583d046fc8841c8f3e3577.tar.bz2 manaplus-2549b4753c78726677583d046fc8841c8f3e3577.tar.xz manaplus-2549b4753c78726677583d046fc8841c8f3e3577.zip |
eathena: fix packet SMSG_BEING_SPAWN 0x0858.
Also being direction if moved from outside to first visible tile.
Diffstat (limited to 'src/net/eathena/beinghandler.cpp')
-rw-r--r-- | src/net/eathena/beinghandler.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp index 1d75bbe62..f06c9fc2c 100644 --- a/src/net/eathena/beinghandler.cpp +++ b/src/net/eathena/beinghandler.cpp @@ -528,6 +528,7 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg) const { uint16_t srcX, srcY, dstX, dstY; msg.readCoordinatePair(srcX, srcY, dstX, dstY, "move path"); + msg.readUInt8("(sx<<4) | (sy&0x0f)"); localPlayer->followMoveTo(dstBeing, srcX, srcY, dstX, dstY); @@ -737,7 +738,7 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg) const uint32_t weapon = static_cast<uint32_t>(msg.readInt32("weapon")); const uint16_t headBottom = msg.readInt16("head bottom"); - if (!visible) + if (!visible && !spawn) msg.readInt32("tick"); const uint16_t headTop = msg.readInt16("head top"); @@ -794,11 +795,34 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg) { uint16_t srcX, srcY, dstX, dstY; msg.readCoordinatePair(srcX, srcY, dstX, dstY, "move path"); + msg.readUInt8("(sx<<4) | (sy&0x0f)"); msg.readInt8("xs"); msg.readInt8("ys"); dstBeing->setAction(BeingAction::STAND, 0); dstBeing->setTileCoords(srcX, srcY); dstBeing->setDestination(dstX, dstY); + + // because server don't send direction in move packet, + // we fixing it + + int d = 0; + if (srcX == dstX && srcY == dstY) + { // if player did one step from invisible area to visible, + //move path is broken + int x2 = localPlayer->getTileX(); + int y2 = localPlayer->getTileY(); + if (abs(x2 - srcX) > abs(y2 - srcY)) + y2 = srcY; + else + x2 = srcX; + d = dstBeing->calcDirection(x2, y2); + } + else + { + d = dstBeing->calcDirection(dstX, dstY); + } + if (d && dstBeing->getDirection() != d) + dstBeing->setDirection(d); } else { |