summaryrefslogtreecommitdiff
path: root/src/map/npc.c
diff options
context:
space:
mode:
authormomacabu <momacabu@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-12-09 22:14:19 +0000
committermomacabu <momacabu@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-12-09 22:14:19 +0000
commite6376945eb87a94974bfad2a5ca649c9b8d1288f (patch)
tree0c6b7071d87f89b3b89f69cfe24e6acbf7f55b3d /src/map/npc.c
parentecdcdf7dac66dd3f7404c7851f804bf0c1a60842 (diff)
downloadhercules-e6376945eb87a94974bfad2a5ca649c9b8d1288f.tar.gz
hercules-e6376945eb87a94974bfad2a5ca649c9b8d1288f.tar.bz2
hercules-e6376945eb87a94974bfad2a5ca649c9b8d1288f.tar.xz
hercules-e6376945eb87a94974bfad2a5ca649c9b8d1288f.zip
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
Diffstat (limited to 'src/map/npc.c')
-rw-r--r--src/map/npc.c19
1 files changed, 19 insertions, 0 deletions
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);