summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/clif.c1
-rw-r--r--src/map/unit.c22
2 files changed, 18 insertions, 5 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index aa2091054..c8c021233 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -8359,7 +8359,6 @@ void clif_parse_WalkToXY(int fd, struct map_session_data *sd) {
if(sd->sc.count && sd->sc.data[SC_RUN].timer != -1)
return;
- pc_stop_attack(sd);
pc_delinvincibletimer(sd);
cmd = RFIFOW(fd,0);
diff --git a/src/map/unit.c b/src/map/unit.c
index 2a360e6ab..18fffa7f5 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -43,6 +43,7 @@ struct unit_data* unit_bl2ud(struct block_list *bl) {
return NULL;
}
+static int unit_attack_timer(int tid,unsigned int tick,int id,int data);
static int unit_walktoxy_timer(int tid,unsigned int tick,int id,int data);
int unit_walktoxy_sub(struct block_list *bl)
@@ -309,9 +310,14 @@ int unit_walktoxy( struct block_list *bl, int x, int y, int flag) {
// timer関数からunit_walktoxy_subを呼ぶようにする
ud->state.change_walk_target = 1;
return 1;
- } else {
- return unit_walktoxy_sub(bl);
}
+
+ if (ud->attacktimer != -1) {
+ delete_timer( ud->attacktimer, unit_attack_timer );
+ ud->attacktimer = -1;
+ }
+
+ return unit_walktoxy_sub(bl);
}
static int unit_walktobl_sub(int tid,unsigned int tick,int id,int data)
@@ -366,13 +372,21 @@ int unit_walktobl(struct block_list *bl, struct block_list *tbl, int range, int
ud->state.change_walk_target = 1;
return 1;
}
+
if (DIFF_TICK(ud->canmove_tick, gettick()) > 0)
{ //Can't move, wait a bit before invoking the movement.
add_timer(ud->canmove_tick+1, unit_walktobl_sub, bl->id, ud->target);
return 1;
- } else if (!unit_can_move(bl))
+ }
+
+ if (!unit_can_move(bl))
return 0;
-
+
+ if (ud->attacktimer != -1) {
+ delete_timer( ud->attacktimer, unit_attack_timer );
+ ud->attacktimer = -1;
+ }
+
return unit_walktoxy_sub(bl);
}