summaryrefslogtreecommitdiff
path: root/src/emap
diff options
context:
space:
mode:
Diffstat (limited to 'src/emap')
-rw-r--r--src/emap/clif.c10
-rw-r--r--src/emap/send.c14
-rw-r--r--src/emap/send.h2
3 files changed, 20 insertions, 6 deletions
diff --git a/src/emap/clif.c b/src/emap/clif.c
index 91e7260..4eec6a6 100644
--- a/src/emap/clif.c
+++ b/src/emap/clif.c
@@ -13,6 +13,7 @@
#include "common/socket.h"
#include "common/strlib.h"
#include "common/cbasetypes.h"
+#include "common/timer.h"
#include "map/guild.h"
#include "map/mob.h"
#include "map/npc.h"
@@ -434,14 +435,19 @@ void eclif_set_unit_walking(struct block_list* bl, TBL_PC *tsd,
{
TBL_PC *sd = BL_CAST(BL_PC, ud->bl);
if (!sd || !pc_isinvisible(sd))
- send_advmoving(ud, tsd ? &tsd->bl : bl, *target);
+ {
+ if (ud->walktimer != INVALID_TIMER)
+ send_advmoving(ud, true, tsd ? &tsd->bl : bl, *target);
+ else
+ send_advmoving(ud, false, tsd ? &tsd->bl : bl, *target);
+ }
}
void eclif_move(struct unit_data *ud)
{
TBL_PC *sd = BL_CAST(BL_PC, ud->bl);
if (!sd || !pc_isinvisible(sd))
- send_advmoving(ud, ud->bl, AREA_WOS);
+ send_advmoving(ud, false, ud->bl, AREA_WOS);
}
void eclif_parse_LoadEndAck_pre(int *fdPtr __attribute__ ((unused)),
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);
}
diff --git a/src/emap/send.h b/src/emap/send.h
index e278c90..0addd9d 100644
--- a/src/emap/send.h
+++ b/src/emap/send.h
@@ -13,7 +13,7 @@ void send_changelook(struct map_session_data* sd, struct map_session_data* sd2,
void send_mapmask(int fd, int mask);
void send_mapmask_brodcast(const int map, const int mask);
void send_mob_info(struct block_list* bl1, struct block_list* bl2, enum send_target 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);
void send_changemusic_brodcast(const int map, const char *music);
void send_changenpc_title (TBL_PC *sd, const int npcId, const char *name);
void send_join_ack(int fd, const char *const name, int flag);