summaryrefslogtreecommitdiff
path: root/src/mapgen_v6.cpp
diff options
context:
space:
mode:
authorWeblate <42@minetest.ru>2013-06-21 10:24:16 +0200
committerWeblate <42@minetest.ru>2013-06-21 10:24:16 +0200
commit3af90db5b51da0c37f77fe6410e488c8c27acd67 (patch)
tree12edd6f0661b464e36863517241b5ec0b87b5ec1 /src/mapgen_v6.cpp
parent58f3cd3eb598a7cf79983fe9e48c738591c6e004 (diff)
parentb1ebd9f79c63cf78b0e0fb2ea6f52d82cdfb95b6 (diff)
downloadminetest-3af90db5b51da0c37f77fe6410e488c8c27acd67.tar.gz
minetest-3af90db5b51da0c37f77fe6410e488c8c27acd67.tar.bz2
minetest-3af90db5b51da0c37f77fe6410e488c8c27acd67.zip
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'src/mapgen_v6.cpp')
-rw-r--r--src/mapgen_v6.cpp29
1 files changed, 9 insertions, 20 deletions
diff --git a/src/mapgen_v6.cpp b/src/mapgen_v6.cpp
index eaca33988..d3db00dc2 100644
--- a/src/mapgen_v6.cpp
+++ b/src/mapgen_v6.cpp
@@ -79,7 +79,7 @@ MapgenV6::MapgenV6(int mapgenid, MapgenV6Params *params, EmergeManager *emerge)
this->freq_beach = params->freq_beach;
this->ystride = csize.X; //////fix this
-
+
np_cave = &params->np_cave;
np_humidity = &params->np_humidity;
np_trees = &params->np_trees;
@@ -108,23 +108,6 @@ MapgenV6::~MapgenV6() {
//////////////////////// Some helper functions for the map generator
-// Returns Y one under area minimum if not found
-s16 MapgenV6::find_ground_level(v2s16 p2d) {
- v3s16 em = vm->m_area.getExtent();
- s16 y_nodes_max = vm->m_area.MaxEdge.Y;
- s16 y_nodes_min = vm->m_area.MinEdge.Y;
- u32 i = vm->m_area.index(p2d.X, y_nodes_max, p2d.Y);
- s16 y;
-
- for (y = y_nodes_max; y >= y_nodes_min; y--) {
- MapNode &n = vm->m_data[i];
- if(ndef->get(n).walkable)
- break;
-
- vm->m_area.add_y(em, i, -1);
- }
- return (y >= y_nodes_min) ? y : y_nodes_min - 1;
-}
// Returns Y one under area minimum if not found
s16 MapgenV6::find_stone_level(v2s16 p2d) {
@@ -462,6 +445,12 @@ void MapgenV6::makeChunk(BlockMakeData *data) {
// Generate some trees, and add grass, if a jungle
if (flags & MG_TREES)
placeTreesAndJungleGrass();
+
+ // Generate the registered decorations
+ for (unsigned int i = 0; i != emerge->decorations.size(); i++) {
+ Decoration *deco = emerge->decorations[i];
+ deco->placeDeco(this, blockseed + i, node_min, node_max);
+ }
// Generate the registered ores
for (unsigned int i = 0; i != emerge->ores.size(); i++) {
@@ -849,7 +838,7 @@ void MapgenV6::placeTreesAndJungleGrass() {
s16 x = grassrandom.range(p2d_min.X, p2d_max.X);
s16 z = grassrandom.range(p2d_min.Y, p2d_max.Y);
- s16 y = find_ground_level(v2s16(x, z)); ////////////////optimize this!
+ s16 y = findGroundLevelFull(v2s16(x, z)); ////////////////optimize this!
if (y < water_level || y < node_min.Y || y > node_max.Y)
continue;
@@ -866,7 +855,7 @@ void MapgenV6::placeTreesAndJungleGrass() {
for (u32 i = 0; i < tree_count; i++) {
s16 x = myrand_range(p2d_min.X, p2d_max.X);
s16 z = myrand_range(p2d_min.Y, p2d_max.Y);
- s16 y = find_ground_level(v2s16(x, z)); ////////////////////optimize this!
+ s16 y = findGroundLevelFull(v2s16(x, z)); ////////////////////optimize this!
// Don't make a tree under water level
// Don't make a tree so high that it doesn't fit
if(y < water_level || y > node_max.Y - 6)