1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-11 17:51:04 +00:00

fixed block unloading from memory (a better fix coming next)

This commit is contained in:
Perttu Ahola 2011-06-26 21:53:11 +03:00
parent d702a2c33b
commit 3fccc67eb7
8 changed files with 70 additions and 74 deletions

View file

@ -1831,17 +1831,21 @@ void Server::AsyncRunStep()
JMutexAutoLock lock(m_env_mutex);
if(((ServerMap*)(&m_env.getMap()))->isSavingEnabled() == true)
{
// Unload unused data (delete from memory)
m_env.getMap().unloadUnusedData(
g_settings.getFloat("server_unload_unused_sectors_timeout"));
/*u32 deleted_count = m_env.getMap().unloadUnusedData(
g_settings.getFloat("server_unload_unused_sectors_timeout"));
*/
// Save only changed parts
m_env.getMap().save(true);
// Delete unused sectors
u32 deleted_count = m_env.getMap().unloadUnusedData(
g_settings.getFloat("server_unload_unused_sectors_timeout"));
if(deleted_count > 0)
/*if(deleted_count > 0)
{
dout_server<<"Server: Unloaded "<<deleted_count
<<" sectors from memory"<<std::endl;
}
<<" blocks from memory"<<std::endl;
}*/
// Save players
m_env.serializePlayers(m_mapsavedir);