aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2020-05-07 21:39:04 +0200
committersfan5 <sfan5@live.de>2020-05-07 22:02:22 +0200
commit650168cadac2a45277a9527ae79efb288ba7a4a4 (patch)
treeb8ff8942a1e94eb0cf85ea9b52a0b4da2fa740fa /src
parent4f9ccd89b347dad3db5ce63d3405a8d60c163af5 (diff)
downloadminetest-650168cadac2a45277a9527ae79efb288ba7a4a4.tar.gz
minetest-650168cadac2a45277a9527ae79efb288ba7a4a4.tar.bz2
minetest-650168cadac2a45277a9527ae79efb288ba7a4a4.zip
Fix Server triggering wrong errors if environment init fails
Diffstat (limited to 'src')
-rw-r--r--src/serverenvironment.cpp6
-rw-r--r--src/serverenvironment.h2
2 files changed, 8 insertions, 0 deletions
diff --git a/src/serverenvironment.cpp b/src/serverenvironment.cpp
index 27432e973..6bf7399cf 100644
--- a/src/serverenvironment.cpp
+++ b/src/serverenvironment.cpp
@@ -624,6 +624,9 @@ PlayerSAO *ServerEnvironment::loadPlayer(RemotePlayer *player, bool *new_player,
void ServerEnvironment::saveMeta()
{
+ if (!m_meta_loaded)
+ return;
+
std::string path = m_path_world + DIR_DELIM "env_meta.txt";
// Open file and serialize
@@ -650,6 +653,9 @@ void ServerEnvironment::saveMeta()
void ServerEnvironment::loadMeta()
{
+ SANITY_CHECK(!m_meta_loaded);
+ m_meta_loaded = true;
+
// 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"
diff --git a/src/serverenvironment.h b/src/serverenvironment.h
index f814b95c0..e2f1a3784 100644
--- a/src/serverenvironment.h
+++ b/src/serverenvironment.h
@@ -440,6 +440,8 @@ private:
IntervalLimiter m_active_blocks_management_interval;
IntervalLimiter m_active_block_modifier_interval;
IntervalLimiter m_active_blocks_nodemetadata_interval;
+ // Whether the variables below have been read from file yet
+ bool m_meta_loaded = false;
// Time from the beginning of the game in seconds.
// Incremented in step().
u32 m_game_time = 0;