From 07bc13f9d9e0418c2d4b173432ba33d4f943aed7 Mon Sep 17 00:00:00 2001 From: ediejohnny Date: Tue, 8 Jan 2013 03:53:20 +0000 Subject: Fixed a problem with the @follow command, that was stick the character when turned the @follow off. (bugreport:7139) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@17084 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/unit.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/map/unit.c') diff --git a/src/map/unit.c b/src/map/unit.c index 111f49065..b05e83455 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -74,6 +74,9 @@ int unit_walktoxy_sub(struct block_list *bl) memcpy(&ud->walkpath,&wpd,sizeof(wpd)); + if( bl->type == BL_PC && ((TBL_PC *)bl)->followtarget == -1 && ((TBL_PC *)bl)->followtimer == INVALID_TIMER ) + ud->target_to = 0; + if (ud->target_to && ud->chaserange>1) { //Generally speaking, the walk path is already to an adjacent tile //so we only need to shorten the path if the range is greater than 1. @@ -392,12 +395,13 @@ int unit_walktobl(struct block_list *bl, struct block_list *tbl, int range, int { struct unit_data *ud = NULL; struct status_change *sc = NULL; + nullpo_ret(bl); nullpo_ret(tbl); ud = unit_bl2ud(bl); if( ud == NULL) return 0; - + if (!(status_get_mode(bl)&MD_CANMOVE)) return 0; @@ -407,13 +411,13 @@ int unit_walktobl(struct block_list *bl, struct block_list *tbl, int range, int ud->target_to = 0; return 0; } - + ud->state.walk_easy = flag&1; ud->target_to = tbl->id; ud->chaserange = range; //Note that if flag&2, this SHOULD be attack-range ud->state.attack_continue = flag&2?1:0; //Chase to attack. unit_set_target(ud, 0); - + sc = status_get_sc(bl); if (sc && sc->data[SC_CONFUSION]) //Randomize the target position map_random_dir(bl, &ud->to_x, &ud->to_y); @@ -423,7 +427,7 @@ int unit_walktobl(struct block_list *bl, struct block_list *tbl, int range, int set_mobstate(bl, flag&2); 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); -- cgit v1.2.3-60-g2f50