summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorParamat <paramat@users.noreply.github.com>2018-06-02 03:20:09 +0100
committerGitHub <noreply@github.com>2018-06-02 03:20:09 +0100
commit99143f494711034068685b6ee845ce19fa09d7d9 (patch)
treeaee8a35185cc669dba00505d9a83bd2a03db648f
parent162ffd7fba9d4e79a29f65686f3efbebaee9cee8 (diff)
downloadminetest-99143f494711034068685b6ee845ce19fa09d7d9.tar.gz
minetest-99143f494711034068685b6ee845ce19fa09d7d9.tar.bz2
minetest-99143f494711034068685b6ee845ce19fa09d7d9.zip
Biomemap: Avoid empty biomemap entry to fix failing biome dust (#7393)
'generateBiomes()' constructs the biomemap as it generates biomes. The biome calculated at first stone surface encountered is added to the biomemap. Previously, if no stone surface was encountered in a mapchunk column the biomemap was left empty for that (x, z) position, causing biome dust and water surface decoration placement to fail. If at the base of a mapchunk column the biomemap is empty, add the currently active biome to the biomemap, or if biome is NULL calculate it for this position and add it to the biomemap.
-rw-r--r--src/mapgen/mapgen.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mapgen/mapgen.cpp b/src/mapgen/mapgen.cpp
index 6ffe0ec1e..eb7803144 100644
--- a/src/mapgen/mapgen.cpp
+++ b/src/mapgen/mapgen.cpp
@@ -692,6 +692,7 @@ void MapgenBasic::generateBiomes()
// (Re)calculate biome
biome = biomegen->getBiomeAtIndex(index, v3s16(x, y, z));
+ // Add biome to biomemap at first stone surface detected
if (biomemap[index] == BIOME_NONE && is_stone_surface)
biomemap[index] = biome->index;
@@ -761,6 +762,19 @@ void MapgenBasic::generateBiomes()
VoxelArea::add_y(em, vi, -1);
}
+ // If no stone surface was detected in this mapchunk column the biomemap
+ // will be empty for this (x, z) position. Add the currently active
+ // biome to the biomemap, or if biome is NULL calculate it for this
+ // position.
+ if (biomemap[index] == BIOME_NONE) {
+ if (biome) {
+ biomemap[index] = biome->index;
+ } else {
+ biome =
+ biomegen->getBiomeAtIndex(index, v3s16(x, node_min.Y, z));
+ biomemap[index] = biome->index;
+ }
+ }
}
}