Fix zone crash on spawn condition change

The NPC pointer held by Spawn2 wasn't reset if the npc was depopped
without a respawn timer by #depop commands or depop(false) quest apis.
If the NPC was part of a spawn condition then the condition would try
to dereference that pointer (which gets deleted) on condition change.
This commit is contained in:
hg 2021-01-08 20:12:36 -05:00
parent 0f5a7e1317
commit 836210404c

View File

@ -968,9 +968,12 @@ void NPC::Depop(bool StartSpawnTimer) {
if(emoteid != 0)
this->DoNPCEmote(ONDESPAWN,emoteid);
p_depop = true;
if (StartSpawnTimer) {
if (respawn2 != 0) {
if (respawn2)
{
if (StartSpawnTimer) {
respawn2->DeathReset();
} else {
respawn2->Depop();
}
}
}