Use cChunkDef::Height for Y coord comparison where applicable.
This commit is contained in:
parent
a893c53d46
commit
b268db4caa
@ -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++)
|
||||
{
|
||||
|
@ -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),
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user