summaryrefslogtreecommitdiff
path: root/src/map/npc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/npc.c')
-rw-r--r--src/map/npc.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/map/npc.c b/src/map/npc.c
index 6d950399d..e9e472721 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -971,6 +971,35 @@ int npc_touch_areanpc(struct map_session_data *sd,int m,int x,int y)
return 0;
}
+int npc_touch_areanpc2(struct block_list *bl)
+{
+ int i,m=bl->m;
+ int xs,ys;
+
+ for(i=0;i<map[m].npc_num;i++) {
+ if (map[m].npc[i]->sc.option&OPTION_INVISIBLE)
+ continue;
+
+ if (map[m].npc[i]->bl.subtype!=WARP)
+ continue;
+
+ xs=map[m].npc[i]->u.warp.xs;
+ ys=map[m].npc[i]->u.warp.ys;
+
+ if (bl->x >= map[m].npc[i]->bl.x-xs/2 && bl->x < map[m].npc[i]->bl.x-xs/2+xs &&
+ bl->y >= map[m].npc[i]->bl.y-ys/2 && bl->y < map[m].npc[i]->bl.y-ys/2+ys)
+ break;
+ }
+ if (i==map[m].npc_num)
+ return 0;
+
+ xs = map_mapindex2mapid(map[m].npc[i]->u.warp.mapindex);
+ if (xs < 0) // Can't warp object between map servers...
+ return 0;
+ unit_warp(bl, xs, map[m].npc[i]->u.warp.x,map[m].npc[i]->u.warp.y,0);
+ return 1;
+}
+
/*==========================================
* 近くかどうかの判定
*------------------------------------------