mirror of
https://github.com/EQEmu/Server.git
synced 2026-02-21 09:32:25 +00:00
Change zone timer resolutions based on zone having players or not
This commit is contained in:
parent
eec6687083
commit
984b50504c
21
zone/net.cpp
21
zone/net.cpp
@ -442,7 +442,7 @@ int main(int argc, char** argv) {
|
||||
std::unique_ptr<EQ::Net::EQStreamManager> eqsm;
|
||||
std::chrono::time_point<std::chrono::system_clock> 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user