From c2989e019a668e1d79e1917a153822bb7dc3ae07 Mon Sep 17 00:00:00 2001 From: zimp-wow <66187107+zimp-wow@users.noreply.github.com> Date: Wed, 9 Apr 2025 21:11:05 -0500 Subject: [PATCH] [Bugfix] Prevent depops from blocking new spawns. (#4841) --- zone/entity.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/zone/entity.cpp b/zone/entity.cpp index 58f33d9fc..4eb080cb8 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -3159,6 +3159,13 @@ void EntityList::Depop(bool StartSpawnTimer) UpdateFindableNPCState(pnpc, true); } + // Depop below will eventually remove this npc from the entity list + // but that can happen AFTER we've already tried to spawn its replacement. + // So go ahead and remove it from the limits so it doesn't count. + if (npc_limit_list.count(pnpc->GetID())) { + npc_limit_list.erase(pnpc->GetID()); + } + pnpc->WipeHateList(); pnpc->Depop(StartSpawnTimer); }