summaryrefslogtreecommitdiff
path: root/src/content/subgames.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/subgames.cpp')
-rw-r--r--src/content/subgames.cpp32
1 files changed, 20 insertions, 12 deletions
diff --git a/src/content/subgames.cpp b/src/content/subgames.cpp
index e9dc609b0..62e82e0e4 100644
--- a/src/content/subgames.cpp
+++ b/src/content/subgames.cpp
@@ -24,7 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "log.h"
#include "util/strfnd.h"
#include "defaultsettings.h" // for set_default_settings
-#include "mapgen/mapgen.h" // for MapgenParams
+#include "map_settings_manager.h"
#include "util/string.h"
#ifndef SERVER
@@ -113,6 +113,10 @@ SubgameSpec findSubgame(const std::string &id)
if (user != share || user_game)
mods_paths.insert(user + DIR_DELIM + "mods");
+ for (const std::string &mod_path : getEnvModPaths()) {
+ mods_paths.insert(mod_path);
+ }
+
// Get meta
std::string conf_path = game_path + DIR_DELIM + "game.conf";
Settings conf;
@@ -354,6 +358,7 @@ void loadGameConfAndInitWorld(const std::string &path, const std::string &name,
conf.set("backend", "sqlite3");
conf.set("player_backend", "sqlite3");
conf.set("auth_backend", "sqlite3");
+ conf.set("mod_storage_backend", "sqlite3");
conf.setBool("creative_mode", g_settings->getBool("creative_mode"));
conf.setBool("enable_damage", g_settings->getBool("enable_damage"));
@@ -365,22 +370,25 @@ void loadGameConfAndInitWorld(const std::string &path, const std::string &name,
// Create map_meta.txt if does not already exist
std::string map_meta_path = final_path + DIR_DELIM + "map_meta.txt";
if (!fs::PathExists(map_meta_path)) {
- verbosestream << "Creating map_meta.txt (" << map_meta_path << ")"
- << std::endl;
- std::ostringstream oss(std::ios_base::binary);
-
- Settings conf;
- MapgenParams params;
+ MapSettingsManager mgr(map_meta_path);
- params.readParams(g_settings);
- params.writeParams(&conf);
- conf.writeLines(oss);
- oss << "[end_of_params]\n";
+ mgr.setMapSetting("seed", g_settings->get("fixed_map_seed"));
- fs::safeWriteToFile(map_meta_path, oss.str());
+ mgr.makeMapgenParams();
+ mgr.saveMapMeta();
}
// The Settings object is no longer needed for created worlds
if (new_game_settings)
delete game_settings;
}
+
+std::vector<std::string> getEnvModPaths()
+{
+ const char *c_mod_path = getenv("MINETEST_MOD_PATH");
+ std::vector<std::string> paths;
+ Strfnd search_paths(c_mod_path ? c_mod_path : "");
+ while (!search_paths.at_end())
+ paths.push_back(search_paths.next(PATH_DELIM));
+ return paths;
+}