forked from Mirrorlandia_minetest/minetest
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
This commit is contained in:
parent
00dfced195
commit
47bcf2f7ac
@ -291,16 +291,16 @@ bool loadGameConfAndInitWorld(const std::string &path, const SubgameSpec &gamesp
|
|||||||
// Create world.mt if does not already exist
|
// Create world.mt if does not already exist
|
||||||
std::string worldmt_path = path + DIR_DELIM "world.mt";
|
std::string worldmt_path = path + DIR_DELIM "world.mt";
|
||||||
if (!fs::PathExists(worldmt_path)) {
|
if (!fs::PathExists(worldmt_path)) {
|
||||||
std::ostringstream ss(std::ios_base::binary);
|
Settings conf;
|
||||||
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;
|
|
||||||
|
|
||||||
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
|
// Create map_meta.txt if does not already exist
|
||||||
|
Loading…
Reference in New Issue
Block a user