From c40fe9a082500a23bf38d5ad93751cb794a37fed Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 15 Feb 2018 19:58:42 +0300 Subject: Delete npcs from always visible list on map if npc unloaded. --- src/emap/map.c | 6 ++++++ src/emap/npc.c | 1 + 2 files changed, 7 insertions(+) diff --git a/src/emap/map.c b/src/emap/map.c index 4125636..1fc0132 100644 --- a/src/emap/map.c +++ b/src/emap/map.c @@ -603,6 +603,12 @@ void map_alwaysVisible_send(TBL_PC *sd) { const int id = VECTOR_INDEX(data->npcs, f); TBL_NPC *npc = map->id2nd(id); + if (npc == NULL) + { + ShowError("npc present in always visible list " + "but not in map: id=%d\n", id); + continue; + } clif->set_unit_idle(&npc->bl, sd, SELF); clif->charnameack(sd->fd, &npc->bl); } diff --git a/src/emap/npc.c b/src/emap/npc.c index 5dee49d..e3a3a20 100644 --- a/src/emap/npc.c +++ b/src/emap/npc.c @@ -268,6 +268,7 @@ int enpc_unload_pre(struct npc_data** ndPtr, { struct npc_data *nd = *ndPtr; nullpo_ret(nd); + map_alwaysVisible_delete(&nd->bl); if (nd->subtype == SCRIPT) { if (nd->src_id != 0) -- cgit v1.2.3-60-g2f50