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
1 changed files with 15 additions and 12 deletions

View File

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