players to not be saved when map saving is disabled (due to some error)

This commit is contained in:
Perttu Ahola 2011-02-14 11:10:44 +02:00
parent 14fafc7217
commit 32a29489f3

@ -1395,20 +1395,23 @@ void Server::AsyncRunStep()
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)
if(((ServerMap*)(&m_env.getMap()))->isSavingEnabled() == true)
{
dout_server<<"Server: Unloaded "<<deleted_count
<<" sectors from memory"<<std::endl;
}
// Save only changed parts
m_env.getMap().save(true);
// Save players
m_env.serializePlayers(m_mapsavedir);
// 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;
}
// Save players
m_env.serializePlayers(m_mapsavedir);
}
}
}
}