Fixed a problem with the @follow command, that was stick the character when turned the @follow off. (bugreport:7139)

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@17084 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
ediejohnny 2013-01-08 03:53:20 +00:00
parent 3ff38b017a
commit 50feb29b5b

View File

@ -74,6 +74,9 @@ int unit_walktoxy_sub(struct block_list *bl)
memcpy(&ud->walkpath,&wpd,sizeof(wpd)); 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) { if (ud->target_to && ud->chaserange>1) {
//Generally speaking, the walk path is already to an adjacent tile //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. //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 unit_data *ud = NULL;
struct status_change *sc = NULL; struct status_change *sc = NULL;
nullpo_ret(bl); nullpo_ret(bl);
nullpo_ret(tbl); nullpo_ret(tbl);
ud = unit_bl2ud(bl); ud = unit_bl2ud(bl);
if( ud == NULL) return 0; if( ud == NULL) return 0;
if (!(status_get_mode(bl)&MD_CANMOVE)) if (!(status_get_mode(bl)&MD_CANMOVE))
return 0; return 0;
@ -407,13 +411,13 @@ int unit_walktobl(struct block_list *bl, struct block_list *tbl, int range, int
ud->target_to = 0; ud->target_to = 0;
return 0; return 0;
} }
ud->state.walk_easy = flag&1; ud->state.walk_easy = flag&1;
ud->target_to = tbl->id; ud->target_to = tbl->id;
ud->chaserange = range; //Note that if flag&2, this SHOULD be attack-range ud->chaserange = range; //Note that if flag&2, this SHOULD be attack-range
ud->state.attack_continue = flag&2?1:0; //Chase to attack. ud->state.attack_continue = flag&2?1:0; //Chase to attack.
unit_set_target(ud, 0); unit_set_target(ud, 0);
sc = status_get_sc(bl); sc = status_get_sc(bl);
if (sc && sc->data[SC_CONFUSION]) //Randomize the target position if (sc && sc->data[SC_CONFUSION]) //Randomize the target position
map_random_dir(bl, &ud->to_x, &ud->to_y); 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); set_mobstate(bl, flag&2);
return 1; return 1;
} }
if(DIFF_TICK(ud->canmove_tick, gettick()) > 0) if(DIFF_TICK(ud->canmove_tick, gettick()) > 0)
{ //Can't move, wait a bit before invoking the movement. { //Can't move, wait a bit before invoking the movement.
add_timer(ud->canmove_tick+1, unit_walktobl_sub, bl->id, ud->target); add_timer(ud->canmove_tick+1, unit_walktobl_sub, bl->id, ud->target);