summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMoritz Borcherding <moritz.borcherding@web.de>2016-09-18 21:43:30 +0200
committerMattes D <github@xoft.cz>2016-09-27 14:32:20 +0200
commitb268db4caae1b5612ae0f3adabf164efc06de368 (patch)
treea85e615101f7b61f0ebd8c2f73c5068c7b112f88
parentAPIDump: Fixed description for tolua functions. (diff)
downloadcuberite-b268db4caae1b5612ae0f3adabf164efc06de368.tar
cuberite-b268db4caae1b5612ae0f3adabf164efc06de368.tar.gz
cuberite-b268db4caae1b5612ae0f3adabf164efc06de368.tar.bz2
cuberite-b268db4caae1b5612ae0f3adabf164efc06de368.tar.lz
cuberite-b268db4caae1b5612ae0f3adabf164efc06de368.tar.xz
cuberite-b268db4caae1b5612ae0f3adabf164efc06de368.tar.zst
cuberite-b268db4caae1b5612ae0f3adabf164efc06de368.zip
-rw-r--r--src/Blocks/BlockLeaves.h2
-rw-r--r--src/ClientHandle.cpp4
-rw-r--r--src/Defines.h2
-rw-r--r--src/Entities/Entity.cpp4
-rw-r--r--src/Generating/FinishGen.cpp4
-rw-r--r--src/WorldStorage/MapSerializer.cpp2
-rw-r--r--src/WorldStorage/SchematicFileSerializer.cpp2
7 files changed, 10 insertions, 10 deletions
diff --git a/src/Blocks/BlockLeaves.h b/src/Blocks/BlockLeaves.h
index 84e186b4c..6c2905171 100644
--- a/src/Blocks/BlockLeaves.h
+++ b/src/Blocks/BlockLeaves.h
@@ -166,7 +166,7 @@ bool HasNearLog(cBlockArea & a_Area, int a_BlockX, int a_BlockY, int a_BlockZ)
a_Area.SetBlockType(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_SPONGE);
for (int i = 0; i < LEAVES_CHECK_DISTANCE; i++)
{
- for (int y = std::max(a_BlockY - i, 0); y <= std::min(a_BlockY + i, 255); y++)
+ for (int y = std::max(a_BlockY - i, 0); y <= std::min(a_BlockY + i, cChunkDef::Height - 1); y++)
{
for (int z = a_BlockZ - i; z <= a_BlockZ + i; z++)
{
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index 21947af13..8df60ad40 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -77,11 +77,11 @@ cClientHandle::cClientHandle(const AString & a_IPString, int a_ViewDistance) :
m_BlockDigAnimStage(-1),
m_BlockDigAnimSpeed(0),
m_BlockDigAnimX(0),
- m_BlockDigAnimY(256), // Invalid Y, so that the coords don't get picked up
+ m_BlockDigAnimY(cChunkDef::Height + 1), // Invalid Y, so that the coords don't get picked up
m_BlockDigAnimZ(0),
m_HasStartedDigging(false),
m_LastDigBlockX(0),
- m_LastDigBlockY(256), // Invalid Y, so that the coords don't get picked up
+ m_LastDigBlockY(cChunkDef::Height + 1), // Invalid Y, so that the coords don't get picked up
m_LastDigBlockZ(0),
m_State(csConnected),
m_ShouldCheckDownloaded(false),
diff --git a/src/Defines.h b/src/Defines.h
index afd806c4e..b9a90cc81 100644
--- a/src/Defines.h
+++ b/src/Defines.h
@@ -557,7 +557,7 @@ inline void AddFaceDirection(int & a_BlockX, unsigned char & a_BlockY, int & a_B
{
int Y = a_BlockY;
AddFaceDirection(a_BlockX, Y, a_BlockZ, a_BlockFace, a_bInverse);
- a_BlockY = Clamp<unsigned char>(static_cast<unsigned char>(Y), 0, 255);
+ a_BlockY = Clamp<unsigned char>(static_cast<unsigned char>(Y), 0, cChunkDef::Height - 1);
}
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp
index b2fa56143..48d07fbbc 100644
--- a/src/Entities/Entity.cpp
+++ b/src/Entities/Entity.cpp
@@ -1458,7 +1458,7 @@ bool cEntity::DetectPortal()
cWorld * TargetWorld = cRoot::Get()->GetWorld(GetWorld()->GetLinkedOverworldName());
ASSERT(TargetWorld != nullptr); // The linkage checker should have prevented this at startup. See cWorld::start()
LOGD("Jumping %s -> %s", DimensionToString(dimNether).c_str(), DimensionToString(DestionationDim).c_str());
- new cNetherPortalScanner(this, TargetWorld, TargetPos, 256);
+ new cNetherPortalScanner(this, TargetWorld, TargetPos, cChunkDef::Height);
return true;
}
// Nether portal in the overworld
@@ -1490,7 +1490,7 @@ bool cEntity::DetectPortal()
cWorld * TargetWorld = cRoot::Get()->GetWorld(GetWorld()->GetLinkedNetherWorldName());
ASSERT(TargetWorld != nullptr); // The linkage checker should have prevented this at startup. See cWorld::start()
LOGD("Jumping %s -> %s", DimensionToString(dimOverworld).c_str(), DimensionToString(DestionationDim).c_str());
- new cNetherPortalScanner(this, TargetWorld, TargetPos, 128);
+ new cNetherPortalScanner(this, TargetWorld, TargetPos, (cChunkDef::Height / 2));
return true;
}
}
diff --git a/src/Generating/FinishGen.cpp b/src/Generating/FinishGen.cpp
index 3f6a1dc7a..4b2cafbca 100644
--- a/src/Generating/FinishGen.cpp
+++ b/src/Generating/FinishGen.cpp
@@ -517,7 +517,7 @@ void cFinishGenTallGrass::GenFinish(cChunkDesc & a_ChunkDesc)
// Get the top block + 1. This is the place where the grass would finaly be placed:
int y = a_ChunkDesc.GetHeight(x, z) + 1;
- if (y >= 255)
+ if (y >= cChunkDef::Height - 1)
{
continue;
}
@@ -1221,7 +1221,7 @@ void cFinishGenPreSimulator::StationarizeFluid(
cFinishGenFluidSprings::cFinishGenFluidSprings(int a_Seed, BLOCKTYPE a_Fluid, cIniFile & a_IniFile, eDimension a_Dimension) :
m_Noise(a_Seed + a_Fluid * 100), // Need to take fluid into account, otherwise water and lava springs generate next to each other
- m_HeightDistribution(255),
+ m_HeightDistribution(cChunkDef::Height - 1),
m_Fluid(a_Fluid)
{
bool IsWater = (a_Fluid == E_BLOCK_WATER);
diff --git a/src/WorldStorage/MapSerializer.cpp b/src/WorldStorage/MapSerializer.cpp
index 3899ad505..c34efe507 100644
--- a/src/WorldStorage/MapSerializer.cpp
+++ b/src/WorldStorage/MapSerializer.cpp
@@ -163,7 +163,7 @@ bool cMapSerializer::LoadMapFromNBT(const cParsedNBT & a_NBT)
if ((CurrLine >= 0) && (a_NBT.GetType(CurrLine) == TAG_Short))
{
unsigned int Height = static_cast<unsigned int>(a_NBT.GetShort(CurrLine));
- if (Height >= 256)
+ if (Height >= cChunkDef::Height)
{
return false;
}
diff --git a/src/WorldStorage/SchematicFileSerializer.cpp b/src/WorldStorage/SchematicFileSerializer.cpp
index 3fc36e86c..d6bcf840f 100644
--- a/src/WorldStorage/SchematicFileSerializer.cpp
+++ b/src/WorldStorage/SchematicFileSerializer.cpp
@@ -164,7 +164,7 @@ bool cSchematicFileSerializer::LoadFromSchematicNBT(cBlockArea & a_BlockArea, cP
int SizeX = a_NBT.GetShort(TSizeX);
int SizeY = a_NBT.GetShort(TSizeY);
int SizeZ = a_NBT.GetShort(TSizeZ);
- if ((SizeX < 1) || (SizeX > 65535) || (SizeY < 1) || (SizeY > 256) || (SizeZ < 1) || (SizeZ > 65535))
+ if ((SizeX < 1) || (SizeX > 65535) || (SizeY < 1) || (SizeY > cChunkDef::Height) || (SizeZ < 1) || (SizeZ > 65535))
{
LOG("Dimensions are invalid in the schematic file: %d, %d, %d", SizeX, SizeY, SizeZ);
return false;