summaryrefslogtreecommitdiffstats
path: root/src/World.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-03-19 12:46:37 +0100
committerMattes D <github@xoft.cz>2015-03-19 12:46:37 +0100
commitf3046417ec605f5a1605849481bd43dbdb5fdee1 (patch)
tree2aed73f3232bf784bd7bab26912132b49e3eb13f /src/World.cpp
parentAllToLua: Removed an unneeded class declaration. (diff)
downloadcuberite-f3046417ec605f5a1605849481bd43dbdb5fdee1.tar
cuberite-f3046417ec605f5a1605849481bd43dbdb5fdee1.tar.gz
cuberite-f3046417ec605f5a1605849481bd43dbdb5fdee1.tar.bz2
cuberite-f3046417ec605f5a1605849481bd43dbdb5fdee1.tar.lz
cuberite-f3046417ec605f5a1605849481bd43dbdb5fdee1.tar.xz
cuberite-f3046417ec605f5a1605849481bd43dbdb5fdee1.tar.zst
cuberite-f3046417ec605f5a1605849481bd43dbdb5fdee1.zip
Diffstat (limited to 'src/World.cpp')
-rw-r--r--src/World.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/World.cpp b/src/World.cpp
index 05eccb0fa..292ff9b94 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -714,6 +714,7 @@ void cWorld::GenerateRandomSpawn(void)
bool cWorld::CheckPlayerSpawnPoint(int a_PosX, int a_PosY, int a_PosZ)
{
+ // Check that spawnblock and surrounding blocks are neither solid nor water / lava
static const struct
{
int x, z;
@@ -725,26 +726,22 @@ bool cWorld::CheckPlayerSpawnPoint(int a_PosX, int a_PosY, int a_PosZ)
{ 0, -1 },
{ 0, 1 },
};
-
- // Checking that spawnblock and surrounding blocks are air and not water/lava
for (size_t i = 0; i < ARRAYCOUNT(Coords); i++)
{
BLOCKTYPE BlockType = GetBlock(a_PosX + Coords[i].x, a_PosY, a_PosZ + Coords[i].x);
-
if (cBlockInfo::IsSolid(BlockType) || IsBlockLiquid(BlockType))
{
return false;
}
} // for i - Coords[]
- // Check if block below is solid
- BLOCKTYPE BlockType = GetBlock(a_PosX, a_PosY - 1, a_PosZ);
- if (!cBlockInfo::IsSolid(BlockType))
+ // Check that the block below is solid:
+ if (!cBlockInfo::IsSolid(GetBlock(a_PosX, a_PosY - 1, a_PosZ)))
{
return false;
}
- // Checking that all the blocks above the spawnpoint is air.
+ // Check that all the blocks above the spawnpoint are not solid:
for (int i = a_PosY; i < cChunkDef::Height; i++)
{
BLOCKTYPE BlockType = GetBlock(a_PosX, i, a_PosZ);