Adjusted height validation using cChunkDef::IsValidHeight()
This commit is contained in:
parent
07adddb810
commit
b87e0b6b15
@ -77,7 +77,7 @@ public:
|
|||||||
|
|
||||||
BLOCKTYPE DestBlock;
|
BLOCKTYPE DestBlock;
|
||||||
NIBBLETYPE DestMeta;
|
NIBBLETYPE DestMeta;
|
||||||
if ((a_RelY + OfsY < 0) || (a_RelY + OfsY >= cChunkDef::Height - 1))
|
if (!cChunkDef::IsValidHeight(a_RelY + OfsY))
|
||||||
{
|
{
|
||||||
// Y Coord out of range
|
// Y Coord out of range
|
||||||
continue;
|
continue;
|
||||||
|
@ -1132,7 +1132,7 @@ void cChunk::GrowCactus(int a_RelX, int a_RelY, int a_RelZ, int a_NumBlocks)
|
|||||||
|
|
||||||
bool cChunk::UnboundedRelGetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta) const
|
bool cChunk::UnboundedRelGetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta) const
|
||||||
{
|
{
|
||||||
if ((a_RelY < 0) || (a_RelY >= cChunkDef::Height))
|
if (!cChunkDef::IsValidHeight(a_RelY))
|
||||||
{
|
{
|
||||||
LOGWARNING("%s: requesting a block with a_RelY out of range: %d", __FUNCTION__, a_RelY);
|
LOGWARNING("%s: requesting a block with a_RelY out of range: %d", __FUNCTION__, a_RelY);
|
||||||
return false;
|
return false;
|
||||||
@ -1153,7 +1153,7 @@ bool cChunk::UnboundedRelGetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE
|
|||||||
|
|
||||||
bool cChunk::UnboundedRelGetBlockType(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE & a_BlockType) const
|
bool cChunk::UnboundedRelGetBlockType(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE & a_BlockType) const
|
||||||
{
|
{
|
||||||
if ((a_RelY < 0) || (a_RelY >= cChunkDef::Height))
|
if (!cChunkDef::IsValidHeight(a_RelY))
|
||||||
{
|
{
|
||||||
LOGWARNING("%s: requesting a block with a_RelY out of range: %d", __FUNCTION__, a_RelY);
|
LOGWARNING("%s: requesting a block with a_RelY out of range: %d", __FUNCTION__, a_RelY);
|
||||||
return false;
|
return false;
|
||||||
@ -1174,7 +1174,7 @@ bool cChunk::UnboundedRelGetBlockType(int a_RelX, int a_RelY, int a_RelZ, BLOCKT
|
|||||||
|
|
||||||
bool cChunk::UnboundedRelGetBlockMeta(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE & a_BlockMeta) const
|
bool cChunk::UnboundedRelGetBlockMeta(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE & a_BlockMeta) const
|
||||||
{
|
{
|
||||||
if ((a_RelY < 0) || (a_RelY >= cChunkDef::Height))
|
if (!cChunkDef::IsValidHeight(a_RelY))
|
||||||
{
|
{
|
||||||
LOGWARNING("%s: requesting a block with a_RelY out of range: %d", __FUNCTION__, a_RelY);
|
LOGWARNING("%s: requesting a block with a_RelY out of range: %d", __FUNCTION__, a_RelY);
|
||||||
return false;
|
return false;
|
||||||
@ -1195,7 +1195,7 @@ bool cChunk::UnboundedRelGetBlockMeta(int a_RelX, int a_RelY, int a_RelZ, NIBBLE
|
|||||||
|
|
||||||
bool cChunk::UnboundedRelGetBlockBlockLight(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE & a_BlockBlockLight) const
|
bool cChunk::UnboundedRelGetBlockBlockLight(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE & a_BlockBlockLight) const
|
||||||
{
|
{
|
||||||
if ((a_RelY < 0) || (a_RelY >= cChunkDef::Height))
|
if (!cChunkDef::IsValidHeight(a_RelY))
|
||||||
{
|
{
|
||||||
LOGWARNING("%s: requesting a block with a_RelY out of range: %d", __FUNCTION__, a_RelY);
|
LOGWARNING("%s: requesting a block with a_RelY out of range: %d", __FUNCTION__, a_RelY);
|
||||||
return false;
|
return false;
|
||||||
@ -1216,7 +1216,7 @@ bool cChunk::UnboundedRelGetBlockBlockLight(int a_RelX, int a_RelY, int a_RelZ,
|
|||||||
|
|
||||||
bool cChunk::UnboundedRelGetBlockSkyLight(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE & a_BlockSkyLight) const
|
bool cChunk::UnboundedRelGetBlockSkyLight(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE & a_BlockSkyLight) const
|
||||||
{
|
{
|
||||||
if ((a_RelY < 0) || (a_RelY >= cChunkDef::Height))
|
if (!cChunkDef::IsValidHeight(a_RelY))
|
||||||
{
|
{
|
||||||
LOGWARNING("%s: requesting a block with a_RelY out of range: %d", __FUNCTION__, a_RelY);
|
LOGWARNING("%s: requesting a block with a_RelY out of range: %d", __FUNCTION__, a_RelY);
|
||||||
return false;
|
return false;
|
||||||
@ -1237,7 +1237,7 @@ bool cChunk::UnboundedRelGetBlockSkyLight(int a_RelX, int a_RelY, int a_RelZ, NI
|
|||||||
|
|
||||||
bool cChunk::UnboundedRelGetBlockLights(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE & a_BlockLight, NIBBLETYPE & a_SkyLight) const
|
bool cChunk::UnboundedRelGetBlockLights(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE & a_BlockLight, NIBBLETYPE & a_SkyLight) const
|
||||||
{
|
{
|
||||||
if ((a_RelY < 0) || (a_RelY >= cChunkDef::Height))
|
if (!cChunkDef::IsValidHeight(a_RelY))
|
||||||
{
|
{
|
||||||
LOGWARNING("%s: requesting a block with a_RelY out of range: %d", __FUNCTION__, a_RelY);
|
LOGWARNING("%s: requesting a block with a_RelY out of range: %d", __FUNCTION__, a_RelY);
|
||||||
return false;
|
return false;
|
||||||
@ -1259,7 +1259,7 @@ bool cChunk::UnboundedRelGetBlockLights(int a_RelX, int a_RelY, int a_RelZ, NIBB
|
|||||||
|
|
||||||
bool cChunk::UnboundedRelSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
|
bool cChunk::UnboundedRelSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
|
||||||
{
|
{
|
||||||
if ((a_RelY < 0) || (a_RelY >= cChunkDef::Height))
|
if (!cChunkDef::IsValidHeight(a_RelY))
|
||||||
{
|
{
|
||||||
LOGWARNING("UnboundedRelSetBlock(): requesting a block with a_RelY out of range: %d", a_RelY);
|
LOGWARNING("UnboundedRelSetBlock(): requesting a block with a_RelY out of range: %d", a_RelY);
|
||||||
return false;
|
return false;
|
||||||
@ -1280,7 +1280,7 @@ bool cChunk::UnboundedRelSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE
|
|||||||
|
|
||||||
bool cChunk::UnboundedRelFastSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
|
bool cChunk::UnboundedRelFastSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
|
||||||
{
|
{
|
||||||
if ((a_RelY < 0) || (a_RelY >= cChunkDef::Height))
|
if (!cChunkDef::IsValidHeight(a_RelY))
|
||||||
{
|
{
|
||||||
LOGWARNING("UnboundedRelFastSetBlock(): requesting a block with a_RelY out of range: %d", a_RelY);
|
LOGWARNING("UnboundedRelFastSetBlock(): requesting a block with a_RelY out of range: %d", a_RelY);
|
||||||
return false;
|
return false;
|
||||||
@ -1301,7 +1301,7 @@ bool cChunk::UnboundedRelFastSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKT
|
|||||||
|
|
||||||
void cChunk::UnboundedQueueTickBlock(int a_RelX, int a_RelY, int a_RelZ)
|
void cChunk::UnboundedQueueTickBlock(int a_RelX, int a_RelY, int a_RelZ)
|
||||||
{
|
{
|
||||||
if ((a_RelY < 0) || (a_RelY >= cChunkDef::Height))
|
if (!cChunkDef::IsValidHeight(a_RelY))
|
||||||
{
|
{
|
||||||
// Outside of chunkmap
|
// Outside of chunkmap
|
||||||
return;
|
return;
|
||||||
|
@ -1859,7 +1859,7 @@ bool cChunkMap::ForEachEntityInBox(const cBoundingBox & a_Box, cEntityCallback &
|
|||||||
void cChunkMap::DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_BlockY, double a_BlockZ, cVector3iArray & a_BlocksAffected)
|
void cChunkMap::DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_BlockY, double a_BlockZ, cVector3iArray & a_BlocksAffected)
|
||||||
{
|
{
|
||||||
// Don't explode if outside of Y range (prevents the following test running into unallocated memory):
|
// Don't explode if outside of Y range (prevents the following test running into unallocated memory):
|
||||||
if ((a_BlockY < 0) || (a_BlockY > cChunkDef::Height - 1))
|
if (!cChunkDef::IsValidHeight(static_cast<int>(a_BlockY)))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user