mirror of
				https://github.com/luanti-org/luanti.git
				synced 2025-11-04 01:05:48 +01:00 
			
		
		
		
	ServerEnvironment::loadDefaultMeta: Loading default meta is only possible for ServerEnv itself
This commit is contained in:
		@@ -274,13 +274,7 @@ Server::Server(
 | 
			
		||||
	// Register us to receive map edit events
 | 
			
		||||
	servermap->addEventReceiver(this);
 | 
			
		||||
 | 
			
		||||
	// If file exists, load environment metadata
 | 
			
		||||
	if (fs::PathExists(m_path_world + DIR_DELIM "env_meta.txt")) {
 | 
			
		||||
		infostream << "Server: Loading environment metadata" << std::endl;
 | 
			
		||||
		m_env->loadMeta();
 | 
			
		||||
	} else {
 | 
			
		||||
		m_env->loadDefaultMeta();
 | 
			
		||||
	}
 | 
			
		||||
	m_env->loadMeta();
 | 
			
		||||
 | 
			
		||||
	m_liquid_transform_every = g_settings->getFloat("liquid_update");
 | 
			
		||||
	m_max_chatmessage_length = g_settings->getU16("chat_message_max_size");
 | 
			
		||||
 
 | 
			
		||||
@@ -614,6 +614,16 @@ void ServerEnvironment::saveMeta()
 | 
			
		||||
 | 
			
		||||
void ServerEnvironment::loadMeta()
 | 
			
		||||
{
 | 
			
		||||
	// If file doesn't exist, load default environment metadata
 | 
			
		||||
	if (!fs::PathExists(m_path_world + DIR_DELIM "env_meta.txt")) {
 | 
			
		||||
		infostream << "ServerEnvironment: Loading default environment metadata"
 | 
			
		||||
			<< std::endl;
 | 
			
		||||
		loadDefaultMeta();
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	infostream << "ServerEnvironment: Loading environment metadata" << std::endl;
 | 
			
		||||
 | 
			
		||||
	std::string path = m_path_world + DIR_DELIM "env_meta.txt";
 | 
			
		||||
 | 
			
		||||
	// Open file and deserialize
 | 
			
		||||
@@ -664,6 +674,9 @@ void ServerEnvironment::loadMeta()
 | 
			
		||||
		args.getU64("day_count") : 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * called if env_meta.txt doesn't exist (e.g. new world)
 | 
			
		||||
 */
 | 
			
		||||
void ServerEnvironment::loadDefaultMeta()
 | 
			
		||||
{
 | 
			
		||||
	m_lbm_mgr.loadIntroductionTimes("", m_server, m_game_time);
 | 
			
		||||
 
 | 
			
		||||
@@ -232,9 +232,6 @@ public:
 | 
			
		||||
	*/
 | 
			
		||||
	void saveMeta();
 | 
			
		||||
	void loadMeta();
 | 
			
		||||
	// to be called instead of loadMeta if
 | 
			
		||||
	// env_meta.txt doesn't exist (e.g. new world)
 | 
			
		||||
	void loadDefaultMeta();
 | 
			
		||||
 | 
			
		||||
	u32 addParticleSpawner(float exptime);
 | 
			
		||||
	u32 addParticleSpawner(float exptime, u16 attached_id);
 | 
			
		||||
@@ -371,6 +368,11 @@ public:
 | 
			
		||||
			const Settings &cmd_args);
 | 
			
		||||
private:
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * called if env_meta.txt doesn't exist (e.g. new world)
 | 
			
		||||
	 */
 | 
			
		||||
	void loadDefaultMeta();
 | 
			
		||||
 | 
			
		||||
	static PlayerDatabase *openPlayerDatabase(const std::string &name,
 | 
			
		||||
			const std::string &savedir, const Settings &conf);
 | 
			
		||||
	/*
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user