deal with light sources in discard_migrations()

Otherwise, when discard_migrations() purges monsters,
their stale monster pointers can be left inside the light source data
structure.
This commit is contained in:
nhmall
2024-12-09 21:41:26 -05:00
parent 64d41e10de
commit d99a24843b

View File

@@ -914,6 +914,8 @@ discard_migrations(void)
mtmp->nmon = 0;
discard_minvent(mtmp, FALSE);
/* bypass mongone() and its call to m_detach() plus dmonsfree() */
if (emits_light(mtmp->data))
del_light_source(LS_MONSTER, monst_to_any(mtmp));
dealloc_monst(mtmp);
}
}