aboutsummaryrefslogtreecommitdiff
path: root/src/mapgen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mapgen.cpp')
-rw-r--r--src/mapgen.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/mapgen.cpp b/src/mapgen.cpp
index f2745bdb4..b19073e90 100644
--- a/src/mapgen.cpp
+++ b/src/mapgen.cpp
@@ -35,6 +35,15 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "treegen.h"
#include "mapgen_v6.h"
+FlagDesc flagdesc_mapgen[] = {
+ {"trees", MG_TREES},
+ {"caves", MG_CAVES},
+ {"dungeons", MG_DUNGEONS},
+ {"v6_forests", MGV6_FORESTS},
+ {"v6_biome_blend", MGV6_BIOME_BLEND},
+ {"flat", MG_FLAT},
+ {NULL, 0}
+};
///////////////////////////////////////////////////////////////////////////////
/////////////////////////////// Emerge Manager ////////////////////////////////
@@ -149,7 +158,7 @@ MapgenParams *EmergeManager::getParamsFromSettings(Settings *settings) {
mgparams->seed = settings->getU64(settings == g_settings ? "fixed_map_seed" : "seed");
mgparams->water_level = settings->getS16("water_level");
mgparams->chunksize = settings->getS16("chunksize");
- mgparams->flags = settings->getS32("mg_flags");
+ mgparams->flags = settings->getFlagStr("mg_flags", flagdesc_mapgen);
if (!mgparams->readParams(settings)) {
delete mgparams;
@@ -159,7 +168,18 @@ MapgenParams *EmergeManager::getParamsFromSettings(Settings *settings) {
}
-bool EmergeManager::registerMapgen(std::string mgname, MapgenFactory *mgfactory) {
+void EmergeManager::setParamsToSettings(Settings *settings) {
+ settings->set("mg_name", params->mg_name);
+ settings->setU64("seed", params->seed);
+ settings->setS16("water_level", params->water_level);
+ settings->setS16("chunksize", params->chunksize);
+ settings->setFlagStr("mg_flags", params->flags, flagdesc_mapgen);
+
+ params->writeParams(settings);
+}
+
+
+void EmergeManager::registerMapgen(std::string mgname, MapgenFactory *mgfactory) {
mglist.insert(std::make_pair(mgname, mgfactory));
infostream << "EmergeManager: registered mapgen " << mgname << std::endl;
}