aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mapgen_singlenode.cpp14
-rw-r--r--src/mapgen_singlenode.h5
-rw-r--r--src/mapgen_v6.cpp58
-rw-r--r--src/mapgen_v7.cpp35
4 files changed, 62 insertions, 50 deletions
diff --git a/src/mapgen_singlenode.cpp b/src/mapgen_singlenode.cpp
index 1471e064b..9f2e6c122 100644
--- a/src/mapgen_singlenode.cpp
+++ b/src/mapgen_singlenode.cpp
@@ -38,8 +38,16 @@ void MapgenSinglenodeParams::writeParams(Settings *settings) {
///////////////////////////////////////////////////////////////////////////////
-MapgenSinglenode::MapgenSinglenode(int mapgenid, MapgenParams *params) {
+MapgenSinglenode::MapgenSinglenode(int mapgenid,
+ MapgenParams *params, EmergeManager *emerge)
+{
flags = params->flags;
+
+ INodeDefManager *ndef = emerge->ndef;
+
+ c_node = ndef->getId("mapgen_singlenode");
+ if (c_node == CONTENT_IGNORE)
+ c_node = CONTENT_AIR;
}
@@ -68,10 +76,6 @@ void MapgenSinglenode::makeChunk(BlockMakeData *data) {
// Area of central chunk
v3s16 node_min = blockpos_min*MAP_BLOCKSIZE;
v3s16 node_max = (blockpos_max+v3s16(1,1,1))*MAP_BLOCKSIZE-v3s16(1,1,1);
-
- content_t c_node = ndef->getId("mapgen_singlenode");
- if (c_node == CONTENT_IGNORE)
- c_node = CONTENT_AIR;
MapNode n_node(c_node);
diff --git a/src/mapgen_singlenode.h b/src/mapgen_singlenode.h
index eba85e7ce..9fd1d75b3 100644
--- a/src/mapgen_singlenode.h
+++ b/src/mapgen_singlenode.h
@@ -34,8 +34,9 @@ struct MapgenSinglenodeParams : public MapgenSpecificParams {
class MapgenSinglenode : public Mapgen {
public:
u32 flags;
+ content_t c_node;
- MapgenSinglenode(int mapgenid, MapgenParams *params);
+ MapgenSinglenode(int mapgenid, MapgenParams *params, EmergeManager *emerge);
~MapgenSinglenode();
void makeChunk(BlockMakeData *data);
@@ -44,7 +45,7 @@ public:
struct MapgenFactorySinglenode : public MapgenFactory {
Mapgen *createMapgen(int mgid, MapgenParams *params, EmergeManager *emerge) {
- return new MapgenSinglenode(mgid, params);
+ return new MapgenSinglenode(mgid, params, emerge);
};
MapgenSpecificParams *createMapgenParams() {
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;
diff --git a/src/mapgen_v7.cpp b/src/mapgen_v7.cpp
index a9547fdb0..332865304 100644
--- a/src/mapgen_v7.cpp
+++ b/src/mapgen_v7.cpp
@@ -60,8 +60,8 @@ MapgenV7::MapgenV7(int mapgenid, MapgenParams *params, EmergeManager *emerge) {
this->csize = v3s16(1, 1, 1) * params->chunksize * MAP_BLOCKSIZE;
- // amount of elements to skip for the next index
- // for noise/height/biome maps (not vmanip)
+ //// amount of elements to skip for the next index
+ //// for noise/height/biome maps (not vmanip)
this->ystride = csize.X;
this->zstride = csize.X * csize.Y;
@@ -71,7 +71,7 @@ MapgenV7::MapgenV7(int mapgenid, MapgenParams *params, EmergeManager *emerge) {
MapgenV7Params *sp = (MapgenV7Params *)params->sparams;
- // Terrain noise
+ //// Terrain noise
noise_terrain_base = new Noise(&sp->np_terrain_base, seed, csize.X, csize.Z);
noise_terrain_alt = new Noise(&sp->np_terrain_alt, seed, csize.X, csize.Z);
noise_terrain_persist = new Noise(&sp->np_terrain_persist, seed, csize.X, csize.Z);
@@ -80,13 +80,26 @@ MapgenV7::MapgenV7(int mapgenid, MapgenParams *params, EmergeManager *emerge) {
noise_mount_height = new Noise(&sp->np_mount_height, seed, csize.X, csize.Z);
noise_ridge_uwater = new Noise(&sp->np_ridge_uwater, seed, csize.X, csize.Z);
- // 3d terrain noise
+ //// 3d terrain noise
noise_mountain = new Noise(&sp->np_mountain, seed, csize.X, csize.Y, csize.Z);
noise_ridge = new Noise(&sp->np_ridge, seed, csize.X, csize.Y, csize.Z);
- // Biome noise
+ //// Biome noise
noise_heat = new Noise(bmgr->np_heat, seed, csize.X, csize.Z);
- noise_humidity = new Noise(bmgr->np_humidity, seed, csize.X, csize.Z);
+ noise_humidity = new Noise(bmgr->np_humidity, seed, csize.X, csize.Z);
+
+ //// 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_ice = ndef->getId("default:ice");
+ if (c_ice == CONTENT_IGNORE)
+ c_ice = CONTENT_AIR;
}
@@ -208,16 +221,6 @@ void MapgenV7::makeChunk(BlockMakeData *data) {
blockseed = emerge->getBlockSeed(full_node_min); //////use getBlockSeed2()!
- 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_ice = ndef->getId("default:ice");
- if (c_ice == CONTENT_IGNORE)
- c_ice = CONTENT_AIR;
-
// Make some noise
calculateNoise();