players to not be saved when map saving is disabled (due to some error)
authorPerttu Ahola <celeron55@gmail.com>
Mon, 14 Feb 2011 09:10:44 +0000 (11:10 +0200)
committerPerttu Ahola <celeron55@gmail.com>
Mon, 14 Feb 2011 09:10:44 +0000 (11:10 +0200)
src/server.cpp

index f2078b9d06269190ae81c8877a094a38dbdbcbd8..739698f16b551d492b2b5b7ed63fc951443cf1f7 100644 (file)
@@ -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);
+
+                               // 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);
+                               // Save players
+                               m_env.serializePlayers(m_mapsavedir);
+                       }
                }
        }
 }