summaryrefslogtreecommitdiffstats
path: root/src/Chunk.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Chunk.cpp')
-rw-r--r--src/Chunk.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Chunk.cpp b/src/Chunk.cpp
index 0b8e2d1a9..2e14cf368 100644
--- a/src/Chunk.cpp
+++ b/src/Chunk.cpp
@@ -1616,6 +1616,12 @@ void cChunk::AddBlockEntity(cBlockEntity * a_BlockEntity)
cBlockEntity * cChunk::GetBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ)
{
+ // Check that the query coords are within chunk bounds:
+ ASSERT(a_BlockX >= m_PosX * cChunkDef::Width);
+ ASSERT(a_BlockX < m_PosX * cChunkDef::Width + cChunkDef::Width);
+ ASSERT(a_BlockZ >= m_PosZ * cChunkDef::Width);
+ ASSERT(a_BlockZ < m_PosZ * cChunkDef::Width + cChunkDef::Width);
+
for (cBlockEntityList::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end(); ++itr)
{
if (