summaryrefslogtreecommitdiff
path: root/src/emap
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-02-15 19:58:42 +0300
committerAndrei Karas <akaras@inbox.ru>2018-02-15 19:58:42 +0300
commitc40fe9a082500a23bf38d5ad93751cb794a37fed (patch)
tree34c0c888b75cded72e36295638ac5793a4f4138f /src/emap
parent68c2ea30403890497b05cd0c8ce9d8197324efef (diff)
downloadevol-hercules-c40fe9a082500a23bf38d5ad93751cb794a37fed.tar.gz
evol-hercules-c40fe9a082500a23bf38d5ad93751cb794a37fed.tar.bz2
evol-hercules-c40fe9a082500a23bf38d5ad93751cb794a37fed.tar.xz
evol-hercules-c40fe9a082500a23bf38d5ad93751cb794a37fed.zip
Delete npcs from always visible list on map if npc unloaded.
Diffstat (limited to 'src/emap')
-rw-r--r--src/emap/map.c6
-rw-r--r--src/emap/npc.c1
2 files changed, 7 insertions, 0 deletions
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)