summaryrefslogtreecommitdiff
path: root/src/net/eathena/beinghandler.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-05 01:11:42 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-06 01:18:57 +0300
commit2549b4753c78726677583d046fc8841c8f3e3577 (patch)
treede419fee17b1dcac0523668c1edc7569b18d4b78 /src/net/eathena/beinghandler.cpp
parent8f8a9d2f1791754a1376ba9c7f010ee47d091598 (diff)
downloadmv-2549b4753c78726677583d046fc8841c8f3e3577.tar.gz
mv-2549b4753c78726677583d046fc8841c8f3e3577.tar.bz2
mv-2549b4753c78726677583d046fc8841c8f3e3577.tar.xz
mv-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.cpp26
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
{