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 committed 2021-01-08 23:53:06 -05:00
1 parent 0f5a7e1317
commit 836210404c
1 file changed
+5 -2
+5 -2
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();
}
}
}