diff --git a/common/event/event_loop.h b/common/event/event_loop.h index 268f78c4d..295c0532d 100644 --- a/common/event/event_loop.h +++ b/common/event/event_loop.h @@ -21,6 +21,10 @@ namespace EQ uv_run(&m_loop, UV_RUN_NOWAIT); } + void Run() { + uv_run(&m_loop, UV_RUN_DEFAULT); + } + uv_loop_t* Handle() { return &m_loop; } private: diff --git a/zone/command.cpp b/zone/command.cpp index 9740e0811..a326f4999 100755 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -4252,10 +4252,15 @@ void command_corpsefix(Client *c, const Seperator *sep) void command_reloadworld(Client *c, const Seperator *sep) { - c->Message(Chat::White, "Reloading quest cache and repopping zones worldwide."); + int world_repop = atoi(sep->arg[1]); + if (world_repop == 0) + c->Message(Chat::White, "Reloading quest cache worldwide."); + else + c->Message(Chat::White, "Reloading quest cache and repopping zones worldwide."); + auto pack = new ServerPacket(ServerOP_ReloadWorld, sizeof(ReloadWorld_Struct)); ReloadWorld_Struct* RW = (ReloadWorld_Struct*) pack->pBuffer; - RW->Option = ((atoi(sep->arg[1]) == 1) ? 1 : 0); + RW->Option = world_repop; worldserver.SendPacket(pack); safe_delete(pack); } diff --git a/zone/main.cpp b/zone/main.cpp index 9ee3eda25..6d3eee96c 100644 --- a/zone/main.cpp +++ b/zone/main.cpp @@ -548,29 +548,9 @@ int main(int argc, char** argv) { }; EQ::Timer process_timer(loop_fn); - process_timer.Start(1000, true); + process_timer.Start(32, true); - while (RunLoops) { - bool previous_loaded = is_zone_loaded && numclients > 0; - EQ::EventLoop::Get().Process(); - - bool current_loaded = is_zone_loaded && numclients > 0; - if (previous_loaded && !current_loaded) { - process_timer.Stop(); - process_timer.Start(1000, true); - } - else if (!previous_loaded && current_loaded) { - process_timer.Stop(); - process_timer.Start(32, true); - } - - if (current_loaded) { - Sleep(1); - } - else { - Sleep(10); - } - } + EQ::EventLoop::Get().Run(); entity_list.Clear(); entity_list.RemoveAllEncounters(); // gotta do it manually or rewrite lots of shit :P