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.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/map/npc.c b/src/map/npc.c
index b5fc1cacf..352161189 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -1441,9 +1441,6 @@ int npc_remove_map(struct npc_data* nd)
if(nd->bl.prev == NULL || nd->bl.m < 0)
return 1; //Not assigned to a map.
m = nd->bl.m;
-#ifdef PCRE_SUPPORT
- npc_chat_finalize(nd);
-#endif
clif_clearunit_area(&nd->bl,2);
//Remove corresponding NPC CELLs
if (nd->bl.subtype == WARP) {
@@ -1513,6 +1510,10 @@ int npc_unload(struct npc_data* nd)
if (nd->chat_id) // remove npc chatroom object and kick users
chat_deletenpcchat(nd);
+#ifdef PCRE_SUPPORT
+ npc_chat_finalize(nd); // deallocate npc PCRE data structures
+#endif
+
if (nd->bl.subtype == SCRIPT) {
ev_db->foreach(ev_db,npc_unload_ev,nd->exname); //Clean up all events related.
if (nd->u.scr.timerid != -1) {