summaryrefslogtreecommitdiff
path: root/src/emap/send.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-10-13 00:32:49 +0300
committerAndrei Karas <akaras@inbox.ru>2015-10-13 00:32:49 +0300
commit5b49e94e000d31299e9e97e339e7ad273cdfa032 (patch)
treeb54bca65ee3ec8147c8bd67919d91c0fdd3e110a /src/emap/send.c
parentec69d4fd5c6ec519cb7a04ba74182cbfeceb9cf9 (diff)
downloadplugin-5b49e94e000d31299e9e97e339e7ad273cdfa032.tar.gz
plugin-5b49e94e000d31299e9e97e339e7ad273cdfa032.tar.bz2
plugin-5b49e94e000d31299e9e97e339e7ad273cdfa032.tar.xz
plugin-5b49e94e000d31299e9e97e339e7ad273cdfa032.zip
Remove first moving tile if being already moving.
This fix random one tile wrong moving.
Diffstat (limited to 'src/emap/send.c')
-rw-r--r--src/emap/send.c14
1 files changed, 11 insertions, 3 deletions
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);
}