summaryrefslogtreecommitdiffstats
path: root/src/ChunkData.cpp
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2016-04-23 09:22:25 +0200
committerLogicParrot <LogicParrot@users.noreply.github.com>2016-04-23 09:22:25 +0200
commit611cb8cb4e17c55b1dc913837268bf9dd423df75 (patch)
tree1d4f49943813a5309ef081ae8f9e696a388ba8a4 /src/ChunkData.cpp
parentUpdated readme to inform that clang 3.4 is minimum required version. (#3158) (diff)
parentOut of world blocks are now always considered air blocks (diff)
downloadcuberite-611cb8cb4e17c55b1dc913837268bf9dd423df75.tar
cuberite-611cb8cb4e17c55b1dc913837268bf9dd423df75.tar.gz
cuberite-611cb8cb4e17c55b1dc913837268bf9dd423df75.tar.bz2
cuberite-611cb8cb4e17c55b1dc913837268bf9dd423df75.tar.lz
cuberite-611cb8cb4e17c55b1dc913837268bf9dd423df75.tar.xz
cuberite-611cb8cb4e17c55b1dc913837268bf9dd423df75.tar.zst
cuberite-611cb8cb4e17c55b1dc913837268bf9dd423df75.zip
Diffstat (limited to 'src/ChunkData.cpp')
-rw-r--r--src/ChunkData.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/ChunkData.cpp b/src/ChunkData.cpp
index 88cb9fdd8..ab29e4ed3 100644
--- a/src/ChunkData.cpp
+++ b/src/ChunkData.cpp
@@ -150,9 +150,14 @@ cChunkData::~cChunkData()
BLOCKTYPE cChunkData::GetBlock(int a_X, int a_Y, int a_Z) const
{
- ASSERT((a_X >= 0) && (a_X < cChunkDef::Width));
- ASSERT((a_Y >= 0) && (a_Y < cChunkDef::Height));
- ASSERT((a_Z >= 0) && (a_Z < cChunkDef::Width));
+ if (
+ (a_X < 0) || (a_X >= cChunkDef::Width) ||
+ (a_Y < 0) || (a_Y >= cChunkDef::Height) ||
+ (a_Z < 0) || (a_Z >= cChunkDef::Width)
+ )
+ {
+ return E_BLOCK_AIR; // Coordinates are outside outside the world, so this must be an air block
+ }
int Section = a_Y / SectionHeight;
if (m_Sections[Section] != nullptr)
{
@@ -222,7 +227,7 @@ NIBBLETYPE cChunkData::GetMeta(int a_RelX, int a_RelY, int a_RelZ) const
return 0;
}
}
- ASSERT(!"cChunkData::GetMeta(): coords out of chunk range!");
+ // Coordinates are outside outside the world, so it must be an air block with a blank meta
return 0;
}