summaryrefslogtreecommitdiff
path: root/src/map.cpp
diff options
context:
space:
mode:
authorngosang <diegodelasheras@gmail.com>2015-01-26 12:44:49 +0100
committerShadowNinja <shadowninja@minetest.net>2015-03-07 15:53:39 -0500
commitf6e4c5d9cf459e8278a76a2beaee59732e841458 (patch)
tree6748d30881ddd5b5679d89b4ea5838fb5598fe18 /src/map.cpp
parent9da99efca226c377d3bc2914561edffd812a9c1a (diff)
downloadminetest-f6e4c5d9cf459e8278a76a2beaee59732e841458.tar.gz
minetest-f6e4c5d9cf459e8278a76a2beaee59732e841458.tar.bz2
minetest-f6e4c5d9cf459e8278a76a2beaee59732e841458.zip
Respect game mapgen flags and save world noise params
Diffstat (limited to 'src/map.cpp')
-rw-r--r--src/map.cpp48
1 files changed, 20 insertions, 28 deletions
diff --git a/src/map.cpp b/src/map.cpp
index 14a237c0a..899c80b27 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -3005,26 +3005,20 @@ void ServerMap::saveMapMeta()
{
DSTACK(__FUNCTION_NAME);
- /*infostream<<"ServerMap::saveMapMeta(): "
- <<"seed="<<m_seed
- <<std::endl;*/
-
createDirs(m_savedir);
- std::string fullpath = m_savedir + DIR_DELIM "map_meta.txt";
- std::ostringstream ss(std::ios_base::binary);
-
- Settings params;
+ std::string fullpath = m_savedir + DIR_DELIM + "map_meta.txt";
+ std::ostringstream oss(std::ios_base::binary);
+ Settings conf;
- m_emerge->saveParamsToSettings(&params);
- params.writeLines(ss);
+ m_emerge->params.save(conf);
+ conf.writeLines(oss);
- ss<<"[end_of_params]\n";
+ oss << "[end_of_params]\n";
- if(!fs::safeWriteToFile(fullpath, ss.str()))
- {
- infostream<<"ERROR: ServerMap::saveMapMeta(): "
- <<"could not write "<<fullpath<<std::endl;
+ if(!fs::safeWriteToFile(fullpath, oss.str())) {
+ errorstream << "ServerMap::saveMapMeta(): "
+ << "could not write " << fullpath << std::endl;
throw FileNotGoodException("Cannot save chunk metadata");
}
@@ -3035,24 +3029,22 @@ void ServerMap::loadMapMeta()
{
DSTACK(__FUNCTION_NAME);
- Settings params;
- std::string fullpath = m_savedir + DIR_DELIM "map_meta.txt";
+ Settings conf;
+ std::string fullpath = m_savedir + DIR_DELIM + "map_meta.txt";
- if (fs::PathExists(fullpath)) {
- std::ifstream is(fullpath.c_str(), std::ios_base::binary);
- if (!is.good()) {
- errorstream << "ServerMap::loadMapMeta(): "
- "could not open " << fullpath << std::endl;
- throw FileNotGoodException("Cannot open map metadata");
- }
+ std::ifstream is(fullpath.c_str(), std::ios_base::binary);
+ if (!is.good()) {
+ errorstream << "ServerMap::loadMapMeta(): "
+ "could not open " << fullpath << std::endl;
+ throw FileNotGoodException("Cannot open map metadata");
+ }
- if (!params.parseConfigLines(is, "[end_of_params]")) {
- throw SerializationError("ServerMap::loadMapMeta(): "
+ if (!conf.parseConfigLines(is, "[end_of_params]")) {
+ throw SerializationError("ServerMap::loadMapMeta(): "
"[end_of_params] not found!");
- }
}
- m_emerge->loadParamsFromSettings(&params);
+ m_emerge->params.load(conf);
verbosestream << "ServerMap::loadMapMeta(): seed="
<< m_emerge->params.seed << std::endl;