summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-08-21 22:52:54 +0300
committerAndrei Karas <akaras@inbox.ru>2016-08-21 22:52:54 +0300
commit7f72738f54abef2ec0ae080b58bbfde1c3c02c36 (patch)
treee2ff03a2e380b223f1c592fde0522934c6981171 /src/net
parent194cda54f0bb15befcb0449152957b16f922bb49 (diff)
downloadmanaverse-7f72738f54abef2ec0ae080b58bbfde1c3c02c36.tar.gz
manaverse-7f72738f54abef2ec0ae080b58bbfde1c3c02c36.tar.bz2
manaverse-7f72738f54abef2ec0ae080b58bbfde1c3c02c36.tar.xz
manaverse-7f72738f54abef2ec0ae080b58bbfde1c3c02c36.zip
Improve move3 packet handling for local player and for empty path.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/ea/beingrecv.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/net/ea/beingrecv.cpp b/src/net/ea/beingrecv.cpp
index 9b12583a8..bc1229b5d 100644
--- a/src/net/ea/beingrecv.cpp
+++ b/src/net/ea/beingrecv.cpp
@@ -422,7 +422,7 @@ void BeingRecv::processBeingMove3(Net::MessageIn &msg)
const int len = msg.readInt16("len") - 14;
Being *const dstBeing = actorManager->findBeing(
msg.readBeingId("being id"));
- if (!dstBeing)
+ if (!dstBeing || dstBeing == localPlayer)
{
DEBUGLOGSTR("invisible player?");
msg.readInt16("speed");
@@ -436,14 +436,8 @@ void BeingRecv::processBeingMove3(Net::MessageIn &msg)
dstBeing->setWalkSpeed(speed);
const int16_t x = msg.readInt16("x");
const int16_t y = msg.readInt16("y");
-
- dstBeing->setAction(BeingAction::STAND, 0);
- dstBeing->setTileCoords(x, y);
-
- if (dstBeing == localPlayer)
- return;
-
const unsigned char *moves = msg.readBytes(len, "moving path");
+
Path path;
if (moves)
{
@@ -486,6 +480,11 @@ void BeingRecv::processBeingMove3(Net::MessageIn &msg)
delete [] moves;
}
+ if (path.empty())
+ return;
+
+ dstBeing->setAction(BeingAction::STAND, 0);
+ dstBeing->setTileCoords(x, y);
dstBeing->setPath(path);
BLOCK_END("BeingRecv::processBeingMove3")
}