aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/map_settings_manager.cpp3
-rw-r--r--src/server.cpp3
-rw-r--r--src/server.h4
3 files changed, 9 insertions, 1 deletions
diff --git a/src/map_settings_manager.cpp b/src/map_settings_manager.cpp
index ed65eed1c..99e3cb0e6 100644
--- a/src/map_settings_manager.cpp
+++ b/src/map_settings_manager.cpp
@@ -116,7 +116,8 @@ bool MapSettingsManager::saveMapMeta()
{
// If mapgen params haven't been created yet; abort
if (!mapgen_params) {
- errorstream << "saveMapMeta: mapgen_params not present!" << std::endl;
+ infostream << "saveMapMeta: mapgen_params not present! "
+ << "Server startup was probably interrupted." << std::endl;
return false;
}
diff --git a/src/server.cpp b/src/server.cpp
index b815558fb..af4eb17e2 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -351,6 +351,7 @@ Server::~Server()
// Deinitialize scripting
infostream << "Server: Deinitializing scripting" << std::endl;
delete m_script;
+ delete m_startup_server_map; // if available
delete m_game_settings;
while (!m_unsent_map_edit_queue.empty()) {
@@ -399,6 +400,7 @@ void Server::init()
// Create the Map (loads map_meta.txt, overriding configured mapgen params)
ServerMap *servermap = new ServerMap(m_path_world, this, m_emerge, m_metrics_backend.get());
+ m_startup_server_map = servermap;
// Initialize scripting
infostream << "Server: Initializing Lua" << std::endl;
@@ -440,6 +442,7 @@ void Server::init()
m_craftdef->initHashes(this);
// Initialize Environment
+ m_startup_server_map = nullptr; // Ownership moved to ServerEnvironment
m_env = new ServerEnvironment(servermap, m_script, this, m_path_world);
m_inventory_mgr->setEnv(m_env);
diff --git a/src/server.h b/src/server.h
index 0b4084aa9..9857215d0 100644
--- a/src/server.h
+++ b/src/server.h
@@ -547,6 +547,10 @@ private:
// Environment
ServerEnvironment *m_env = nullptr;
+ // Reference to the server map until ServerEnvironment is initialized
+ // after that this variable must be a nullptr
+ ServerMap *m_startup_server_map = nullptr;
+
// server connection
std::shared_ptr<con::Connection> m_con;