aboutsummaryrefslogtreecommitdiff
path: root/src/server.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server.cpp')
-rw-r--r--src/server.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/server.cpp b/src/server.cpp
index 179147637..4d7947919 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -3523,10 +3523,12 @@ v3f Server::findSpawnPos()
}
bool is_good = false;
+ // Limit spawn range to mapgen edges (determined by 'mapgen_limit')
+ s32 range_max = map.getMapgenParams()->getSpawnRangeMax();
// Try to find a good place a few times
for(s32 i = 0; i < 4000 && !is_good; i++) {
- s32 range = 1 + i;
+ s32 range = MYMIN(1 + i, range_max);
// We're going to try to throw the player to this position
v2s16 nodepos2d = v2s16(
-range + (myrand() % (range * 2)),