aboutsummaryrefslogtreecommitdiff
path: root/src/mapgen_v5.cpp
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2016-06-24 18:15:56 -0400
committerkwolekr <kwolekr@minetest.net>2016-07-03 15:38:36 -0400
commit3c63c3044d5e4ca36c2649c530f31622581d90fd (patch)
treeb7924100f14f5626c11d534e2ad3602e269ac1df /src/mapgen_v5.cpp
parent92705306bfb4994107a43514f29997cea15d48dc (diff)
downloadminetest-3c63c3044d5e4ca36c2649c530f31622581d90fd.tar.gz
minetest-3c63c3044d5e4ca36c2649c530f31622581d90fd.tar.bz2
minetest-3c63c3044d5e4ca36c2649c530f31622581d90fd.zip
Add MapSettingsManager and new mapgen setting script API functions
This commit refactors the majority of the Mapgen settings system. - MapgenParams is now owned by MapSettingsManager, itself a part of ServerMap, instead of the EmergeManager. - New Script API functions added: core.get_mapgen_setting core.get_mapgen_setting_noiseparams, core.set_mapgen_setting, and core.set_mapgen_setting_noiseparams. - minetest.get/set_mapgen_params are deprecated by the above new functions. - It is now possible to view and modify any arbitrary mapgen setting from a mod, rather than the base MapgenParams structure. - MapgenSpecificParams has been removed.
Diffstat (limited to 'src/mapgen_v5.cpp')
-rw-r--r--src/mapgen_v5.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/mapgen_v5.cpp b/src/mapgen_v5.cpp
index 74d5e1ee3..9f189e253 100644
--- a/src/mapgen_v5.cpp
+++ b/src/mapgen_v5.cpp
@@ -45,25 +45,23 @@ FlagDesc flagdesc_mapgen_v5[] = {
};
-MapgenV5::MapgenV5(int mapgenid, MapgenParams *params, EmergeManager *emerge)
+MapgenV5::MapgenV5(int mapgenid, MapgenV5Params *params, EmergeManager *emerge)
: MapgenBasic(mapgenid, params, emerge)
{
- MapgenV5Params *sp = (MapgenV5Params *)params->sparams;
-
- this->spflags = sp->spflags;
- this->cave_width = sp->cave_width;
+ this->spflags = params->spflags;
+ this->cave_width = params->cave_width;
// Terrain noise
- noise_filler_depth = new Noise(&sp->np_filler_depth, seed, csize.X, csize.Z);
- noise_factor = new Noise(&sp->np_factor, seed, csize.X, csize.Z);
- noise_height = new Noise(&sp->np_height, seed, csize.X, csize.Z);
+ noise_filler_depth = new Noise(&params->np_filler_depth, seed, csize.X, csize.Z);
+ noise_factor = new Noise(&params->np_factor, seed, csize.X, csize.Z);
+ noise_height = new Noise(&params->np_height, seed, csize.X, csize.Z);
// 3D terrain noise
// 1-up 1-down overgeneration
- noise_ground = new Noise(&sp->np_ground, seed, csize.X, csize.Y + 2, csize.Z);
+ noise_ground = new Noise(&params->np_ground, seed, csize.X, csize.Y + 2, csize.Z);
- MapgenBasic::np_cave1 = sp->np_cave1;
- MapgenBasic::np_cave2 = sp->np_cave2;
+ MapgenBasic::np_cave1 = params->np_cave1;
+ MapgenBasic::np_cave2 = params->np_cave2;
}