From e6376945eb87a94974bfad2a5ca649c9b8d1288f Mon Sep 17 00:00:00 2001 From: momacabu Date: Sun, 9 Dec 2012 22:14:19 +0000 Subject: Fixed bugreport:6483. NPCs with OnTouch in the same area of a Warp won't block player from being warped. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@17013 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/npc.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/map') diff --git a/src/map/npc.c b/src/map/npc.c index cf267b73c..b7435e089 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -877,6 +877,7 @@ int npc_touch_areanpc(struct map_session_data* sd, int m, int x, int y) int xs,ys; int f = 1; int i; + int j, found_warp = 0; nullpo_retr(1, sd); @@ -920,6 +921,24 @@ int npc_touch_areanpc(struct map_session_data* sd, int m, int x, int y) pc_setpos(sd,map[m].npc[i]->u.warp.mapindex,map[m].npc[i]->u.warp.x,map[m].npc[i]->u.warp.y,CLR_OUTSIGHT); break; case SCRIPT: + for (j = i; j < map[m].npc_num; j++) { + if (map[m].npc[j]->subtype != WARP) { + continue; + } + + if ((sd->bl.x >= (map[m].npc[j]->bl.x - map[m].npc[j]->u.warp.xs) && sd->bl.x <= (map[m].npc[j]->bl.x + map[m].npc[j]->u.warp.xs)) && + (sd->bl.y >= (map[m].npc[j]->bl.y - map[m].npc[j]->u.warp.ys) && sd->bl.y <= (map[m].npc[j]->bl.y + map[m].npc[j]->u.warp.ys))) { + if( pc_ishiding(sd) || (sd->sc.count && sd->sc.data[SC_CAMOUFLAGE]) ) + break; // hidden chars cannot use warps + pc_setpos(sd,map[m].npc[j]->u.warp.mapindex,map[m].npc[j]->u.warp.x,map[m].npc[j]->u.warp.y,CLR_OUTSIGHT); + found_warp = 1; + } + } + + if (found_warp > 0) { + break; + } + if( npc_ontouch_event(sd,map[m].npc[i]) > 0 && npc_ontouch2_event(sd,map[m].npc[i]) > 0 ) { // failed to run OnTouch event, so just click the npc struct unit_data *ud = unit_bl2ud(&sd->bl); -- cgit v1.2.3-60-g2f50