1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Mainmenu game-related changes (#11887)

fixes:
* Switching between games does not immediately hide creative mode / damage buttons if so specified
* World creation menu has a game selection list even though the menu already provides a gamebar
* Showing gameid in world list is unnecessary
* Choice of mapgen parameters in menu persists between games (and was half-broken)
This commit is contained in:
sfan5 2022-01-09 21:15:35 +01:00 committed by GitHub
parent b164e16d1b
commit 4c8c649779
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 262 additions and 210 deletions

View file

@ -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
@ -370,19 +370,12 @@ 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);
MapSettingsManager mgr(map_meta_path);
Settings conf;
MapgenParams params;
mgr.setMapSetting("seed", g_settings->get("fixed_map_seed"));
params.readParams(g_settings);
params.writeParams(&conf);
conf.writeLines(oss);
oss << "[end_of_params]\n";
fs::safeWriteToFile(map_meta_path, oss.str());
mgr.makeMapgenParams();
mgr.saveMapMeta();
}
// The Settings object is no longer needed for created worlds