diff options
author | kwolekr <kwolekr@minetest.net> | 2014-10-30 02:29:37 -0400 |
---|---|---|
committer | kwolekr <kwolekr@minetest.net> | 2014-10-30 02:29:37 -0400 |
commit | 6b4307791af9aab362029883c1cbee207e748af1 (patch) | |
tree | 2be50929d33b386ecfd2dc19d375d5fb975d2b38 /src/mapgen_v6.cpp | |
parent | 03f3f958ed4c21937d93637bd79b3e31c83009d8 (diff) | |
download | minetest-6b4307791af9aab362029883c1cbee207e748af1.tar.gz minetest-6b4307791af9aab362029883c1cbee207e748af1.tar.bz2 minetest-6b4307791af9aab362029883c1cbee207e748af1.zip |
mapgen: Resolve nodes in ctor rather than makeChunk
Diffstat (limited to 'src/mapgen_v6.cpp')
-rw-r--r-- | src/mapgen_v6.cpp | 58 |
1 files changed, 31 insertions, 27 deletions
diff --git a/src/mapgen_v6.cpp b/src/mapgen_v6.cpp index a212496a8..227b57311 100644 --- a/src/mapgen_v6.cpp +++ b/src/mapgen_v6.cpp @@ -71,6 +71,7 @@ MapgenV6::MapgenV6(int mapgenid, MapgenParams *params, EmergeManager *emerge) { np_trees = &sp->np_trees; np_apple_trees = &sp->np_apple_trees; + //// Create noise objects noise_terrain_base = new Noise(&sp->np_terrain_base, seed, csize.X, csize.Y); noise_terrain_higher = new Noise(&sp->np_terrain_higher, seed, csize.X, csize.Y); noise_steepness = new Noise(&sp->np_steepness, seed, csize.X, csize.Y); @@ -78,6 +79,36 @@ MapgenV6::MapgenV6(int mapgenid, MapgenParams *params, EmergeManager *emerge) { noise_mud = new Noise(&sp->np_mud, seed, csize.X, csize.Y); noise_beach = new Noise(&sp->np_beach, seed, csize.X, csize.Y); noise_biome = new Noise(&sp->np_biome, seed, csize.X, csize.Y); + + //// Resolve nodes to be used + INodeDefManager *ndef = emerge->ndef; + + c_stone = ndef->getId("mapgen_stone"); + c_dirt = ndef->getId("mapgen_dirt"); + c_dirt_with_grass = ndef->getId("mapgen_dirt_with_grass"); + c_sand = ndef->getId("mapgen_sand"); + c_water_source = ndef->getId("mapgen_water_source"); + c_lava_source = ndef->getId("mapgen_lava_source"); + c_gravel = ndef->getId("mapgen_gravel"); + c_cobble = ndef->getId("mapgen_cobble"); + c_desert_sand = ndef->getId("mapgen_desert_sand"); + c_desert_stone = ndef->getId("mapgen_desert_stone"); + c_mossycobble = ndef->getId("mapgen_mossycobble"); + c_sandbrick = ndef->getId("mapgen_sandstonebrick"); + c_stair_cobble = ndef->getId("mapgen_stair_cobble"); + c_stair_sandstone = ndef->getId("mapgen_stair_sandstone"); + if (c_desert_sand == CONTENT_IGNORE) + c_desert_sand = c_sand; + if (c_desert_stone == CONTENT_IGNORE) + c_desert_stone = c_stone; + if (c_mossycobble == CONTENT_IGNORE) + c_mossycobble = c_cobble; + if (c_sandbrick == CONTENT_IGNORE) + c_sandbrick = c_desert_stone; + if (c_stair_cobble == CONTENT_IGNORE) + c_stair_cobble = c_cobble; + if (c_stair_sandstone == CONTENT_IGNORE) + c_stair_sandstone = c_sandbrick; } @@ -426,33 +457,6 @@ void MapgenV6::makeChunk(BlockMakeData *data) { // Make some noise calculateNoise(); - c_stone = ndef->getId("mapgen_stone"); - c_dirt = ndef->getId("mapgen_dirt"); - c_dirt_with_grass = ndef->getId("mapgen_dirt_with_grass"); - c_sand = ndef->getId("mapgen_sand"); - c_water_source = ndef->getId("mapgen_water_source"); - c_lava_source = ndef->getId("mapgen_lava_source"); - c_gravel = ndef->getId("mapgen_gravel"); - c_cobble = ndef->getId("mapgen_cobble"); - c_desert_sand = ndef->getId("mapgen_desert_sand"); - c_desert_stone = ndef->getId("mapgen_desert_stone"); - c_mossycobble = ndef->getId("mapgen_mossycobble"); - c_sandbrick = ndef->getId("mapgen_sandstonebrick"); - c_stair_cobble = ndef->getId("mapgen_stair_cobble"); - c_stair_sandstone = ndef->getId("mapgen_stair_sandstone"); - if (c_desert_sand == CONTENT_IGNORE) - c_desert_sand = c_sand; - if (c_desert_stone == CONTENT_IGNORE) - c_desert_stone = c_stone; - if (c_mossycobble == CONTENT_IGNORE) - c_mossycobble = c_cobble; - if (c_sandbrick == CONTENT_IGNORE) - c_sandbrick = c_desert_stone; - if (c_stair_cobble == CONTENT_IGNORE) - c_stair_cobble = c_cobble; - if (c_stair_sandstone == CONTENT_IGNORE) - c_stair_sandstone = c_sandbrick; - // Maximum height of the stone surface and obstacles. // This is used to guide the cave generation s16 stone_surface_max_y; |