diff options
author | red-001 <red-001@outlook.ie> | 2017-06-08 08:50:51 +0100 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-06-08 09:50:51 +0200 |
commit | 47bcf2f7aca26dcdbdd761b33e9ca3509ed32a7e (patch) | |
tree | 629b111b5be0016e114fc45fc82a637c0e28bf43 /src | |
parent | 00dfced1956a3608311b846c85665c9b495b4056 (diff) | |
download | minetest-47bcf2f7aca26dcdbdd761b33e9ca3509ed32a7e.tar.gz minetest-47bcf2f7aca26dcdbdd761b33e9ca3509ed32a7e.tar.bz2 minetest-47bcf2f7aca26dcdbdd761b33e9ca3509ed32a7e.zip |
Use a settings object when generating world.mt and set player_backend to sqlite. (#5940)
* Use a settings object when generating world.mt and set player_backend to sqlite.
* Update subgame.cpp
Diffstat (limited to 'src')
-rw-r--r-- | src/subgame.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/subgame.cpp b/src/subgame.cpp index 55bbd3954..cd2aa752b 100644 --- a/src/subgame.cpp +++ b/src/subgame.cpp @@ -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 |