diff --git a/zone/net.cpp b/zone/net.cpp index 79fa0a2b6..5103bd24b 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -442,7 +442,7 @@ int main(int argc, char** argv) { std::unique_ptr eqsm; std::chrono::time_point frame_prev = std::chrono::system_clock::now(); - EQ::Timer process_timer(32, true, [&](EQ::Timer* t) { + auto loop_fn = [&](EQ::Timer* t) { //Advance the timer to our current point in time Timer::SetCurrentTime(); @@ -529,15 +529,24 @@ int main(int argc, char** argv) { database.ping(); entity_list.UpdateWho(); } - }); + }; + + EQ::Timer process_timer(loop_fn); + process_timer.Start(1000, true); while (RunLoops) { + bool previous_loaded = is_zone_loaded && numclients > 0; EQ::EventLoop::Get().Process(); - if (is_zone_loaded) { - Sleep(1); + Sleep(1); + + bool current_loaded = is_zone_loaded && numclients > 0; + if (previous_loaded && !current_loaded) { + process_timer.Stop(); + process_timer.Start(1000, true); } - else { - Sleep(50); + else if (!previous_loaded && current_loaded) { + process_timer.Stop(); + process_timer.Start(32, true); } }