From 9836c80a9d307b8ede3888cb26f0a32b4bf0db0d Mon Sep 17 00:00:00 2001 From: neckkola <65987027+neckkola@users.noreply.github.com> Date: Sun, 27 Feb 2022 15:25:15 -0400 Subject: [PATCH] Fix repop crash --- zone/gm_commands/repop.cpp | 5 +++-- zone/main.cpp | 2 +- zone/spawn2.cpp | 2 +- zone/zone.cpp | 1 + 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/zone/gm_commands/repop.cpp b/zone/gm_commands/repop.cpp index 114ef6fa5..b4ff199f3 100755 --- a/zone/gm_commands/repop.cpp +++ b/zone/gm_commands/repop.cpp @@ -24,9 +24,10 @@ void command_repop(Client *c, const Seperator *sep) if (!sep->IsNumber(timearg)) { c->Message(Chat::White, "Zone depopped - repopping now."); - + + zone->spawn2_timer.Disable(); zone->Repop(); - + zone->spawn2_timer.Enable(); /* Force a spawn2 timer trigger so we don't delay actually spawning the NPC's */ zone->spawn2_timer.Trigger(); return; diff --git a/zone/main.cpp b/zone/main.cpp index fa6d47259..3dcba3b86 100644 --- a/zone/main.cpp +++ b/zone/main.cpp @@ -579,7 +579,7 @@ int main(int argc, char** argv) { EQ::Timer process_timer(loop_fn); process_timer.Start(32, true); - + EQ::EventLoop::Get().Run(); entity_list.Clear(); diff --git a/zone/spawn2.cpp b/zone/spawn2.cpp index f15ff12c3..e39463be4 100644 --- a/zone/spawn2.cpp +++ b/zone/spawn2.cpp @@ -154,7 +154,7 @@ bool Spawn2::Process() { return true; } - if (timer.Check()) { + if (timer.Check() && zone->spawn2_timer.Enabled()) { timer.Disable(); LogSpawns("Spawn2 [{}]: Timer has triggered", spawn2_id); diff --git a/zone/zone.cpp b/zone/zone.cpp index 2dffad339..13c02ac45 100755 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -1738,6 +1738,7 @@ bool Zone::Depop(bool StartSpawnTimer) { itr = npctable.begin(); delete itr->second; itr->second = nullptr; + npctable.erase(itr); }