summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-12-07 19:24:28 +0300
committerAndrei Karas <akaras@inbox.ru>2014-12-16 22:44:20 +0300
commit3ea017f844af342a24b75c278e69b2821056c2a1 (patch)
tree169f19e733a42959a238d08602f5039fc2a6e5ae
parent3a0bded54bcc5390bf6cd4be9e53206e1bc9e5c2 (diff)
downloadhercules-3ea017f844af342a24b75c278e69b2821056c2a1.tar.gz
hercules-3ea017f844af342a24b75c278e69b2821056c2a1.tar.bz2
hercules-3ea017f844af342a24b75c278e69b2821056c2a1.tar.xz
hercules-3ea017f844af342a24b75c278e69b2821056c2a1.zip
If player left npc, call onUnTouch event.
-rw-r--r--src/map/npc.c9
1 files changed, 8 insertions, 1 deletions
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;
}