summaryrefslogtreecommitdiffstats
path: root/src/World.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-12-20 17:22:26 +0100
committerMattes D <github@xoft.cz>2015-12-20 17:22:26 +0100
commite95a716ba051abec3f57bda7573a99f99a021547 (patch)
tree9a6edb167c90d7c33ece5cad8e2f925ab440408d /src/World.cpp
parentMerge pull request #2780 from cuberite/SpawnRace (diff)
parentFixed spawn point. Wrong number for divisions and wrong highest spawn point. (diff)
downloadcuberite-e95a716ba051abec3f57bda7573a99f99a021547.tar
cuberite-e95a716ba051abec3f57bda7573a99f99a021547.tar.gz
cuberite-e95a716ba051abec3f57bda7573a99f99a021547.tar.bz2
cuberite-e95a716ba051abec3f57bda7573a99f99a021547.tar.lz
cuberite-e95a716ba051abec3f57bda7573a99f99a021547.tar.xz
cuberite-e95a716ba051abec3f57bda7573a99f99a021547.tar.zst
cuberite-e95a716ba051abec3f57bda7573a99f99a021547.zip
Diffstat (limited to 'src/World.cpp')
-rw-r--r--src/World.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/World.cpp b/src/World.cpp
index 47a4e9303..904f5421b 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -613,7 +613,7 @@ void cWorld::GenerateRandomSpawn(int a_MaxSpawnRadius)
}
// A search grid (searches clockwise around the origin)
- static const int HalfChunk = static_cast<int>(cChunkDef::Width / 0.5f);
+ static const int HalfChunk = static_cast<int>(cChunkDef::Width / 2.0f);
static const Vector3i ChunkOffset[] =
{
Vector3i(0, 0, HalfChunk),
@@ -673,8 +673,9 @@ bool cWorld::CanSpawnAt(double a_X, double & a_Y, double a_Z)
static const int ValidSpawnBlocksCount = ARRAYCOUNT(ValidSpawnBlocks);
- static const int HighestSpawnPoint = std::min(static_cast<int>((cChunkDef::Height / 0.5f)) - 1, GetHeight(static_cast<int>(a_X), static_cast<int>(a_Z) + 16));
- static const int LowestSpawnPoint = static_cast<int>(HighestSpawnPoint / 0.5f);
+ // Increase this by two, because we need two more blocks for body and head
+ static const int HighestSpawnPoint = GetHeight(static_cast<int>(a_X), static_cast<int>(a_Z)) + 2;
+ static const int LowestSpawnPoint = static_cast<int>(HighestSpawnPoint / 2.0f);
for (int PotentialY = HighestSpawnPoint; PotentialY > LowestSpawnPoint; --PotentialY)
{