From 0b27e84e040963c35dbbf1ff1440fbc2b0e5142d Mon Sep 17 00:00:00 2001 From: skotlex Date: Sun, 26 Mar 2006 03:37:02 +0000 Subject: - Walk/move functions will abort now when an area npc script triggers and moves the character out of the map. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5750 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/unit.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/map') diff --git a/src/map/unit.c b/src/map/unit.c index fc6c5c578..fe62c5da4 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -193,9 +193,11 @@ static int unit_walktoxy_timer(int tid,unsigned int tick,int id,int data) ud->walktimer = -1; if(sd) { - if(map_getcell(bl->m,x,y,CELL_CHKNPC)) + if(map_getcell(bl->m,x,y,CELL_CHKNPC)) { npc_touch_areanpc(sd,bl->m,x,y); - else + if (bl->prev == NULL) //Script could have warped char, abort remaining of the function. + return 0; + } else sd->areanpc_id=0; if (sd->state.gmaster_flag) { //Guild Aura: Likely needs to be recoded, this method seems inefficient. @@ -343,9 +345,11 @@ int unit_movepos(struct block_list *bl,int dst_x,int dst_y, int easy, int checkp ud->walktimer = -1; if(sd) { - if(map_getcell(bl->m,bl->x,bl->y,CELL_CHKNPC)) + if(map_getcell(bl->m,bl->x,bl->y,CELL_CHKNPC)) { npc_touch_areanpc(sd,bl->m,bl->x,bl->y); - else + if (bl->prev == NULL) //Script could have warped char, abort remaining of the function. + return 0; + } else sd->areanpc_id=0; if(sd->status.pet_id > 0 && sd->pd && sd->pet.intimate > 0) { //Check if pet needs to be teleported. [Skotlex] -- cgit v1.2.3-70-g09d2