summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorediejohnny <ediejohnny@54d463be-8e91-2dee-dedb-b68131a5f0ec>2013-01-08 03:53:20 +0000
committerediejohnny <ediejohnny@54d463be-8e91-2dee-dedb-b68131a5f0ec>2013-01-08 03:53:20 +0000
commit07bc13f9d9e0418c2d4b173432ba33d4f943aed7 (patch)
tree7c70ffe3beeb984b310ac87b7e81310ea672f097 /src/map
parent6f7cee88978bbd8e61ea37e9631e822a77ca37d7 (diff)
downloadhercules-07bc13f9d9e0418c2d4b173432ba33d4f943aed7.tar.gz
hercules-07bc13f9d9e0418c2d4b173432ba33d4f943aed7.tar.bz2
hercules-07bc13f9d9e0418c2d4b173432ba33d4f943aed7.tar.xz
hercules-07bc13f9d9e0418c2d4b173432ba33d4f943aed7.zip
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
Diffstat (limited to 'src/map')
-rw-r--r--src/map/unit.c12
1 files changed, 8 insertions, 4 deletions
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);