summaryrefslogtreecommitdiff
path: root/src/serverenvironment.cpp
diff options
context:
space:
mode:
authorLoic Blot <loic.blot@unix-experience.fr>2018-03-16 08:52:42 +0100
committerLoic Blot <loic.blot@unix-experience.fr>2018-03-16 08:52:42 +0100
commit95ce5583a9e4a0f95a4d9b28e0faedccd73e2b9d (patch)
tree512adae4ad72d5e139b9b4bcc1b187d844f53a9a /src/serverenvironment.cpp
parent858c95630f799f23b06e845848faf241b7e010f0 (diff)
downloadminetest-95ce5583a9e4a0f95a4d9b28e0faedccd73e2b9d.tar.gz
minetest-95ce5583a9e4a0f95a4d9b28e0faedccd73e2b9d.tar.bz2
minetest-95ce5583a9e4a0f95a4d9b28e0faedccd73e2b9d.zip
ServerEnvironment::loadDefaultMeta: Loading default meta is only possible for ServerEnv itself
Diffstat (limited to 'src/serverenvironment.cpp')
-rw-r--r--src/serverenvironment.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/serverenvironment.cpp b/src/serverenvironment.cpp
index 4ca76eead..74b44c730 100644
--- a/src/serverenvironment.cpp
+++ b/src/serverenvironment.cpp
@@ -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);