diff options
author | Perttu Ahola <celeron55@gmail.com> | 2012-03-07 21:44:53 +0200 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2012-03-07 21:44:53 +0200 |
commit | 0309021359ab74e6c7bea2fd983df1780fd9a4bc (patch) | |
tree | 197e5dd60925c315d61e52a762f0751ba8912196 /src | |
parent | 14a71590c361b5417938c79e53879bbb931949f3 (diff) | |
download | minetest-0309021359ab74e6c7bea2fd983df1780fd9a4bc.tar.gz minetest-0309021359ab74e6c7bea2fd983df1780fd9a4bc.tar.bz2 minetest-0309021359ab74e6c7bea2fd983df1780fd9a4bc.zip |
Add dedicated_server_step setting
Diffstat (limited to 'src')
-rw-r--r-- | src/defaultsettings.cpp | 1 | ||||
-rw-r--r-- | src/server.cpp | 7 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 3f6901e8f..6c611d672 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -123,5 +123,6 @@ void set_default_settings(Settings *settings) settings->setDefault("server_map_save_interval", "5.3"); settings->setDefault("full_block_send_enable_min_time_from_building", "2.0"); settings->setDefault("enable_experimental", "false"); + settings->setDefault("dedicated_server_step", "0.05"); } diff --git a/src/server.cpp b/src/server.cpp index bf90b2aa7..97fafd2c2 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -4500,13 +4500,14 @@ void dedicated_server_loop(Server &server, bool &kill) for(;;) { + float steplen = g_settings->getFloat("dedicated_server_step"); // This is kind of a hack but can be done like this // because server.step() is very light { ScopeProfiler sp(g_profiler, "dedicated server sleep"); - sleep_ms(30); + sleep_ms((int)(steplen*1000.0)); } - server.step(0.030); + server.step(steplen); if(server.getShutdownRequested() || kill) { @@ -4521,7 +4522,7 @@ void dedicated_server_loop(Server &server, bool &kill) g_settings->getFloat("profiler_print_interval"); if(profiler_print_interval != 0) { - if(m_profiler_interval.step(0.030, profiler_print_interval)) + if(m_profiler_interval.step(steplen, profiler_print_interval)) { infostream<<"Profiler:"<<std::endl; g_profiler->print(infostream); |