diff options
author | kwolekr <kwolekr@minetest.net> | 2014-02-03 22:42:10 -0500 |
---|---|---|
committer | kwolekr <kwolekr@minetest.net> | 2014-02-03 22:50:14 -0500 |
commit | 5a34f40d80ea1a339b599bc11db549a6bd86912f (patch) | |
tree | 07ead9e3ff4732479af41b739a26b5dc8182c5fd /src/mapgen.cpp | |
parent | a439343844cf821e4922e23f1638b92e2cfb14ac (diff) | |
download | minetest-5a34f40d80ea1a339b599bc11db549a6bd86912f.tar.gz minetest-5a34f40d80ea1a339b599bc11db549a6bd86912f.tar.bz2 minetest-5a34f40d80ea1a339b599bc11db549a6bd86912f.zip |
Huge overhaul of the entire MapgenParams system
MapgenParams is no longer a polymorphic class, eliminating the need for messy and bug-prone reallocations.
Separation between the common and mapgen-specific parameters is now strongly defined.
Mapgen parameters objects are now properly encapsulated within the proper subsystems.
Diffstat (limited to 'src/mapgen.cpp')
-rw-r--r-- | src/mapgen.cpp | 72 |
1 files changed, 1 insertions, 71 deletions
diff --git a/src/mapgen.cpp b/src/mapgen.cpp index a07f24db5..d97c3e609 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -39,15 +39,13 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "util/serialize.h" #include "filesys.h" + FlagDesc flagdesc_mapgen[] = { {"trees", MG_TREES}, {"caves", MG_CAVES}, {"dungeons", MG_DUNGEONS}, - {"v6_jungles", MGV6_JUNGLES}, - {"v6_biome_blend", MGV6_BIOME_BLEND}, {"flat", MG_FLAT}, {"nolight", MG_NOLIGHT}, - {"v6_nomudflow", MGV6_NOMUDFLOW}, {NULL, 0} }; @@ -1124,71 +1122,3 @@ void Mapgen::calcLightingOld(v3s16 nmin, v3s16 nmax) { vm->spreadLight(bank, light_sources, ndef); } } - - -//////////////////////// Mapgen V6 parameter read/write - -bool MapgenV6Params::readParams(Settings *settings) { - freq_desert = settings->getFloat("mgv6_freq_desert"); - freq_beach = settings->getFloat("mgv6_freq_beach"); - - bool success = - settings->getNoiseParams("mgv6_np_terrain_base", np_terrain_base) && - settings->getNoiseParams("mgv6_np_terrain_higher", np_terrain_higher) && - settings->getNoiseParams("mgv6_np_steepness", np_steepness) && - settings->getNoiseParams("mgv6_np_height_select", np_height_select) && - settings->getNoiseParams("mgv6_np_mud", np_mud) && - settings->getNoiseParams("mgv6_np_beach", np_beach) && - settings->getNoiseParams("mgv6_np_biome", np_biome) && - settings->getNoiseParams("mgv6_np_cave", np_cave) && - settings->getNoiseParams("mgv6_np_humidity", np_humidity) && - settings->getNoiseParams("mgv6_np_trees", np_trees) && - settings->getNoiseParams("mgv6_np_apple_trees", np_apple_trees); - return success; -} - - -void MapgenV6Params::writeParams(Settings *settings) { - settings->setFloat("mgv6_freq_desert", freq_desert); - settings->setFloat("mgv6_freq_beach", freq_beach); - - settings->setNoiseParams("mgv6_np_terrain_base", np_terrain_base); - settings->setNoiseParams("mgv6_np_terrain_higher", np_terrain_higher); - settings->setNoiseParams("mgv6_np_steepness", np_steepness); - settings->setNoiseParams("mgv6_np_height_select", np_height_select); - settings->setNoiseParams("mgv6_np_mud", np_mud); - settings->setNoiseParams("mgv6_np_beach", np_beach); - settings->setNoiseParams("mgv6_np_biome", np_biome); - settings->setNoiseParams("mgv6_np_cave", np_cave); - settings->setNoiseParams("mgv6_np_humidity", np_humidity); - settings->setNoiseParams("mgv6_np_trees", np_trees); - settings->setNoiseParams("mgv6_np_apple_trees", np_apple_trees); -} - - -bool MapgenV7Params::readParams(Settings *settings) { - bool success = - settings->getNoiseParams("mgv7_np_terrain_base", np_terrain_base) && - settings->getNoiseParams("mgv7_np_terrain_alt", np_terrain_alt) && - settings->getNoiseParams("mgv7_np_terrain_persist", np_terrain_persist) && - settings->getNoiseParams("mgv7_np_height_select", np_height_select) && - settings->getNoiseParams("mgv7_np_filler_depth", np_filler_depth) && - settings->getNoiseParams("mgv7_np_mount_height", np_mount_height) && - settings->getNoiseParams("mgv7_np_ridge_uwater", np_ridge_uwater) && - settings->getNoiseParams("mgv7_np_mountain", np_mountain) && - settings->getNoiseParams("mgv7_np_ridge", np_ridge); - return success; -} - - -void MapgenV7Params::writeParams(Settings *settings) { - settings->setNoiseParams("mgv7_np_terrain_base", np_terrain_base); - settings->setNoiseParams("mgv7_np_terrain_alt", np_terrain_alt); - settings->setNoiseParams("mgv7_np_terrain_persist", np_terrain_persist); - settings->setNoiseParams("mgv7_np_height_select", np_height_select); - settings->setNoiseParams("mgv7_np_filler_depth", np_filler_depth); - settings->setNoiseParams("mgv7_np_mount_height", np_mount_height); - settings->setNoiseParams("mgv7_np_ridge_uwater", np_ridge_uwater); - settings->setNoiseParams("mgv7_np_mountain", np_mountain); - settings->setNoiseParams("mgv7_np_ridge", np_ridge); -} |