aboutsummaryrefslogtreecommitdiff
path: root/src/server.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server.cpp')
-rw-r--r--src/server.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/server.cpp b/src/server.cpp
index 7260e21d3..7582024d1 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -1321,13 +1321,23 @@ void Server::AsyncRunStep()
{
float &counter = m_savemap_timer;
counter += dtime;
- if(counter >= SERVER_MAP_SAVE_INTERVAL)
+ if(counter >= g_settings.getFloat("server_map_save_interval"))
{
counter = 0.0;
JMutexAutoLock lock(m_env_mutex);
+
// Save only changed parts
m_env.getMap().save(true);
+
+ // Delete unused sectors
+ u32 deleted_count = m_env.getMap().deleteUnusedSectors(
+ g_settings.getFloat("server_unload_unused_sectors_timeout"));
+ if(deleted_count > 0)
+ {
+ dout_server<<"Server: Unloaded "<<deleted_count
+ <<" sectors from memory"<<std::endl;
+ }
}
}
}