]> git.lizzy.rs Git - minetest.git/blobdiff - src/subgame.cpp
Fix arm inertia limit case
[minetest.git] / src / subgame.cpp
index 7e9a0b368e3452f99821c7a39359c5b163086ea2..cd2aa752b56c96ee5049eb1d557d2070569fc615 100644 (file)
@@ -291,16 +291,16 @@ bool loadGameConfAndInitWorld(const std::string &path, const SubgameSpec &gamesp
        // Create world.mt if does not already exist
        std::string worldmt_path = path + DIR_DELIM "world.mt";
        if (!fs::PathExists(worldmt_path)) {
-               std::ostringstream ss(std::ios_base::binary);
-               ss << "gameid = " << gamespec.id
-                       << "\nbackend = sqlite3"
-                       << "\ncreative_mode = " << g_settings->get("creative_mode")
-                       << "\nenable_damage = " << g_settings->get("enable_damage")
-                       << "\n";
-               if (!fs::safeWriteToFile(worldmt_path, ss.str()))
-                       return false;
+               Settings conf;
 
-               infostream << "Wrote world.mt (" << worldmt_path << ")" << std::endl;
+               conf.set("gameid", gamespec.id);
+               conf.set("backend", "sqlite3");
+               conf.set("player_backend", "sqlite3");
+               conf.setBool("creative_mode", g_settings->getBool("creative_mode"));
+               conf.setBool("enable_damage", g_settings->getBool("enable_damage"));
+
+               if (!conf.updateConfigFile(worldmt_path.c_str()))
+                       return false;
        }
 
        // Create map_meta.txt if does not already exist
@@ -313,8 +313,8 @@ bool loadGameConfAndInitWorld(const std::string &path, const SubgameSpec &gamesp
                Settings conf;
                MapgenParams params;
 
-               params.load(*g_settings);
-               params.save(conf);
+               params.readParams(g_settings);
+               params.writeParams(&conf);
                conf.writeLines(oss);
                oss << "[end_of_params]\n";