Fixed chunk possibly writing to uninitialized memory
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1376 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
parent
9687041b14
commit
46197e3be6
@ -831,6 +831,10 @@ bool cChunk::UnboundedRelGetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE
|
|||||||
// Is it in this chunk?
|
// Is it in this chunk?
|
||||||
if ((a_RelX >= 0) && (a_RelX < cChunkDef::Width) && (a_RelZ >= 0) && (a_RelZ < cChunkDef::Width))
|
if ((a_RelX >= 0) && (a_RelX < cChunkDef::Width) && (a_RelZ >= 0) && (a_RelZ < cChunkDef::Width))
|
||||||
{
|
{
|
||||||
|
if (!IsValid())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
int BlockIdx = cChunkDef::MakeIndexNoCheck(a_RelX, a_RelY, a_RelZ);
|
int BlockIdx = cChunkDef::MakeIndexNoCheck(a_RelX, a_RelY, a_RelZ);
|
||||||
a_BlockType = GetBlock(BlockIdx);
|
a_BlockType = GetBlock(BlockIdx);
|
||||||
a_BlockMeta = GetMeta(BlockIdx);
|
a_BlockMeta = GetMeta(BlockIdx);
|
||||||
@ -879,6 +883,10 @@ bool cChunk::UnboundedRelSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE
|
|||||||
// Is it in this chunk?
|
// Is it in this chunk?
|
||||||
if ((a_RelX >= 0) && (a_RelX < cChunkDef::Width) && (a_RelZ >= 0) && (a_RelZ < cChunkDef::Width))
|
if ((a_RelX >= 0) && (a_RelX < cChunkDef::Width) && (a_RelZ >= 0) && (a_RelZ < cChunkDef::Width))
|
||||||
{
|
{
|
||||||
|
if (!IsValid())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
SetBlock(a_RelX, a_RelY, a_RelZ, a_BlockType, a_BlockMeta);
|
SetBlock(a_RelX, a_RelY, a_RelZ, a_BlockType, a_BlockMeta);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -925,6 +933,10 @@ bool cChunk::UnboundedRelFastSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKT
|
|||||||
// Is it in this chunk?
|
// Is it in this chunk?
|
||||||
if ((a_RelX >= 0) && (a_RelX < cChunkDef::Width) && (a_RelZ >= 0) && (a_RelZ < cChunkDef::Width))
|
if ((a_RelX >= 0) && (a_RelX < cChunkDef::Width) && (a_RelZ >= 0) && (a_RelZ < cChunkDef::Width))
|
||||||
{
|
{
|
||||||
|
if (!IsValid())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
FastSetBlock(a_RelX, a_RelY, a_RelZ, a_BlockType, a_BlockMeta);
|
FastSetBlock(a_RelX, a_RelY, a_RelZ, a_BlockType, a_BlockMeta);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user