From: Novatux Date: Sun, 4 Aug 2013 12:14:21 +0000 (+0200) Subject: Change large amount of objects to be configurable via a setting in minetest.conf... X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=fe1fe1b1e42d24dc87a75ef8cc27c5c1dd1cfa4d;p=zefram%2Fminetest%2Fminetest_engine.git Change large amount of objects to be configurable via a setting in minetest.conf (max_objects_per_block). --- diff --git a/minetest.conf.example b/minetest.conf.example index 4c049f87..29900b90 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -274,6 +274,8 @@ # Length of year in days for seasons change. With default time_speed 365 days = 5 real days for year. 30 days = 10 real hours #year_days = 30 #server_unload_unused_data_timeout = 29 +# Maximum number of statically stored objects in a block +#max_objects_per_block = 49 # Interval of saving important changes in the world #server_map_save_interval = 5.3 # To reduce lag, block transfers are slowed down when a player is building something. diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 326e11b8..33adf102 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -180,6 +180,7 @@ void set_default_settings(Settings *settings) settings->setDefault("time_speed", "72"); settings->setDefault("year_days", "30"); settings->setDefault("server_unload_unused_data_timeout", "29"); + settings->setDefault("max_objects_per_block", "49"); settings->setDefault("server_map_save_interval", "5.3"); settings->setDefault("full_block_send_enable_min_time_from_building", "2.0"); settings->setDefault("dedicated_server_step", "0.1"); diff --git a/src/environment.cpp b/src/environment.cpp index 63718f3f..40dba9a6 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -1703,7 +1703,7 @@ void ServerEnvironment::activateObjects(MapBlock *block, u32 dtime_s) <<"activating objects of block "<getPos()) <<" ("<m_static_objects.m_stored.size() <<" objects)"<m_static_objects.m_stored.size() > 49); + bool large_amount = (block->m_static_objects.m_stored.size() > g_settings->getU16("max_objects_per_block")); if(large_amount){ errorstream<<"suspiciously large amount of objects detected: " <m_static_objects.m_stored.size()<<" in " @@ -1881,12 +1881,12 @@ void ServerEnvironment::deactivateFarObjects(bool force_delete) if(block) { - if(block->m_static_objects.m_stored.size() >= 49){ + if(block->m_static_objects.m_stored.size() >= g_settings->getU16("max_objects_per_block")){ errorstream<<"ServerEnv: Trying to store id="<getId() <<" statically but block "<m_static_objects.m_stored.size() - <<" (over 49) objects." + <<" objects." <<" Forcing delete."<