From 5a9744b429094fcbe791f293949f2e8e39568be5 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Wed, 28 Jun 2017 21:23:02 -0500 Subject: [PATCH] Add a fail-safe for dynamic zone shutdown timers --- zone/net.cpp | 3 +++ zone/zone.cpp | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/zone/net.cpp b/zone/net.cpp index f51d50bb4..eafdde807 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -541,6 +541,9 @@ int main(int argc, char** argv) { if (previous_loaded && !current_loaded) { process_timer.Stop(); process_timer.Start(1000, true); + + uint32 shutdown_timer = database.getZoneShutDownDelay(zone->GetZoneID(), zone->GetInstanceVersion()); + zone->StartShutdownTimer(shutdown_timer); } else if (!previous_loaded && current_loaded) { process_timer.Stop(); diff --git a/zone/zone.cpp b/zone/zone.cpp index 086754d55..6a0754dea 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -1414,11 +1414,11 @@ bool Zone::HasWeather() void Zone::StartShutdownTimer(uint32 set_time) { if (set_time > autoshutdown_timer.GetRemainingTime()) { - if (set_time == (RuleI(Zone, AutoShutdownDelay))) - { + if (set_time == (RuleI(Zone, AutoShutdownDelay))) { set_time = database.getZoneShutDownDelay(GetZoneID(), GetInstanceVersion()); } - autoshutdown_timer.Start(set_time, false); + autoshutdown_timer.SetTimer(set_time); + Log(Logs::General, Logs::Zone_Server, "Zone::StartShutdownTimer set to %u", set_time); } }