From 5b49e94e000d31299e9e97e339e7ad273cdfa032 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 13 Oct 2015 00:32:49 +0300 Subject: Remove first moving tile if being already moving. This fix random one tile wrong moving. --- src/emap/send.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/emap/send.c') diff --git a/src/emap/send.c b/src/emap/send.c index 2e0a4ee..29e5d86 100644 --- a/src/emap/send.c +++ b/src/emap/send.c @@ -228,7 +228,7 @@ void send_npc_info(struct block_list* bl1, clif->send(&buf, sizeof(buf), bl2, target); } -void send_advmoving(struct unit_data* ud, struct block_list *tbl, enum send_target target) +void send_advmoving(struct unit_data* ud, bool moving, struct block_list *tbl, enum send_target target) { if (!ud) return; @@ -240,7 +240,15 @@ void send_advmoving(struct unit_data* ud, struct block_list *tbl, enum send_targ const bool haveMoves = (ud->walkpath.path_len > ud->walkpath.path_pos); int i = 14; - const int len = ud->walkpath.path_len - ud->walkpath.path_pos; + int start = ud->walkpath.path_pos; + int len = ud->walkpath.path_len - start; + if (moving) + { + start ++; + len --; + if (len <= 0) + return; + } if (haveMoves) i += len; @@ -253,7 +261,7 @@ void send_advmoving(struct unit_data* ud, struct block_list *tbl, enum send_targ WBUFW (buf, 10) = bl->x; WBUFW (buf, 12) = bl->y; if (haveMoves) - memcpy(buf + 14, ud->walkpath.path + ud->walkpath.path_pos, len); + memcpy(buf + 14, ud->walkpath.path + start, len); clif->send(buf, i, tbl, target); aFree(buf); } -- cgit v1.2.3-60-g2f50