summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-04-09 21:25:19 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-04-09 21:25:19 +0200
commit46197e3be64a73fc9103bd18da49d2582bc10188 (patch)
treedb69c14ba3dfc7f22a4697f19f22bd7f8e9d7274 /source
parentFixed Expat / LuaExpat compilation for Linux (diff)
downloadcuberite-46197e3be64a73fc9103bd18da49d2582bc10188.tar
cuberite-46197e3be64a73fc9103bd18da49d2582bc10188.tar.gz
cuberite-46197e3be64a73fc9103bd18da49d2582bc10188.tar.bz2
cuberite-46197e3be64a73fc9103bd18da49d2582bc10188.tar.lz
cuberite-46197e3be64a73fc9103bd18da49d2582bc10188.tar.xz
cuberite-46197e3be64a73fc9103bd18da49d2582bc10188.tar.zst
cuberite-46197e3be64a73fc9103bd18da49d2582bc10188.zip
Diffstat (limited to 'source')
-rw-r--r--source/Chunk.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/source/Chunk.cpp b/source/Chunk.cpp
index 0a7b39f12..4feb45dc8 100644
--- a/source/Chunk.cpp
+++ b/source/Chunk.cpp
@@ -831,6 +831,10 @@ bool cChunk::UnboundedRelGetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE
// Is it in this chunk?
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);
a_BlockType = GetBlock(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?
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);
return true;
}
@@ -925,6 +933,10 @@ bool cChunk::UnboundedRelFastSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKT
// Is it in this chunk?
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);
return true;
}