aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparamat <paramat@users.noreply.github.com>2017-08-07 06:35:34 +0100
committerparamat <mat.gregory@virginmedia.com>2017-08-09 11:06:33 +0100
commita4048e4e2e6d3c9177270437687118b93c33bf77 (patch)
tree472bae5107ee1841294e3afb931daf5d0dbadf63
parent3d0e8a691ff97a148f8c106bc23875df02226f9c (diff)
downloadminetest-a4048e4e2e6d3c9177270437687118b93c33bf77.tar.gz
minetest-a4048e4e2e6d3c9177270437687118b93c33bf77.tar.bz2
minetest-a4048e4e2e6d3c9177270437687118b93c33bf77.zip
Mgv7: Raise spawn point by 1 node for no mountain case
-rw-r--r--src/mapgen_v7.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mapgen_v7.cpp b/src/mapgen_v7.cpp
index f254a74d8..3ce22dbb1 100644
--- a/src/mapgen_v7.cpp
+++ b/src/mapgen_v7.cpp
@@ -238,20 +238,21 @@ int MapgenV7::getSpawnLevelAtPoint(v2s16 p)
// If mountains are disabled, terrain level is base terrain level.
// Avoids mid-air spawn where mountain terrain would have been.
if (!(spflags & MGV7_MOUNTAINS)) {
- if (y <= water_level || y > max_spawn_y)
+ if (y < water_level || y > max_spawn_y)
return MAX_MAP_GENERATION_LIMIT; // Unsuitable spawn point
else
- // + 1 to not be half-buried in a potential node-deep biome 'dust'
- return y + 1;
+ // y + 2 because y is surface level and due to biome 'dust'
+ return y + 2;
}
// Search upwards for first node without mountain terrain
int iters = 256;
while (iters > 0 && y <= max_spawn_y) {
- if (!getMountainTerrainAtPoint(p.X, y + 1, p.Y)) { // If air above
+ if (!getMountainTerrainAtPoint(p.X, y + 1, p.Y)) {
if (y <= water_level || y > max_spawn_y)
return MAX_MAP_GENERATION_LIMIT; // Unsuitable spawn point
else
+ // y + 1 due to biome 'dust'
return y + 1;
}
y++;