From 3ea017f844af342a24b75c278e69b2821056c2a1 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 7 Dec 2014 19:24:28 +0300 Subject: If player left npc, call onUnTouch event. --- src/map/npc.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/map/npc.c') diff --git a/src/map/npc.c b/src/map/npc.c index 77e99ecc5..8b5bbc83e 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -150,7 +150,7 @@ int npc_onuntouch_event(struct map_session_data *sd, struct npc_data *nd) { char name[EVENT_NAME_LENGTH]; - if (sd->areanpc_id == nd->bl.id) + if (sd->areanpc_id != nd->bl.id) return 0; snprintf(name, ARRAYLENGTH(name), "%s::%s", nd->exname, script->config.onuntouch_name); @@ -980,7 +980,14 @@ int npc_touch_areanpc(struct map_session_data* sd, int16 m, int16 x, int16 y) *------------------------------------------*/ int npc_untouch_areanpc(struct map_session_data* sd, int16 m, int16 x, int16 y) { + struct npc_data *nd; nullpo_retr(1, sd); + + if (!sd->areanpc_id) + return 0; + + nd = (struct npc_data *) map->id2bl(sd->areanpc_id); + npc->onuntouch_event(sd, nd); sd->areanpc_id = 0; return 0; } -- cgit v1.2.3-70-g09d2