From 7f72738f54abef2ec0ae080b58bbfde1c3c02c36 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 21 Aug 2016 22:52:54 +0300 Subject: Improve move3 packet handling for local player and for empty path. --- src/net/ea/beingrecv.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/net') 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") } -- cgit v1.2.3-70-g09d2