Fixed a few possible crashes with out-of-bounds Y coords
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1413 0a769ca7-a7f5-676a-18bf-c427514a06d6master
parent
c40eb92de3
commit
1b7ea2ef82
|
@ -287,9 +287,12 @@ void cBlockHandler::OnDestroyed(cWorld *a_World, int a_BlockX, int a_BlockY, int
|
|||
|
||||
|
||||
void cBlockHandler::NeighborChanged(cWorld *a_World, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
{
|
||||
if ((a_BlockY >= 0) && (a_BlockY < cChunkDef::Height))
|
||||
{
|
||||
GetBlockHandler(a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ))->OnNeighborChanged(a_World, a_BlockX, a_BlockY, a_BlockZ);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1043,6 +1043,12 @@ 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)
|
||||
{
|
||||
if ((a_RelY < 0) || (a_RelY >= cChunkDef::Height))
|
||||
{
|
||||
// Outside of chunkmap
|
||||
return;
|
||||
}
|
||||
|
||||
// Is it in this chunk?
|
||||
if ((a_RelX >= 0) && (a_RelX < cChunkDef::Width) && (a_RelZ >= 0) && (a_RelZ < cChunkDef::Width))
|
||||
{
|
||||
|
@ -1350,6 +1356,12 @@ void cChunk::SetBlock( int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType
|
|||
|
||||
void cChunk::QueueTickBlock(int a_RelX, int a_RelY, int a_RelZ)
|
||||
{
|
||||
ASSERT (
|
||||
(a_RelX >= 0) && (a_RelX < Width) &&
|
||||
(a_RelY >= 0) && (a_RelY < Height) &&
|
||||
(a_RelZ >= 0) && (a_RelZ < Width)
|
||||
); // Coords need to be valid
|
||||
|
||||
if (!IsValid())
|
||||
{
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue