summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2016-03-24 17:18:14 +0100
committerLogicParrot <LogicParrot@users.noreply.github.com>2016-04-23 08:54:34 +0200
commit77bf00a5994cc4cbbca57d70fb8e761a2ea2757f (patch)
tree1d4f49943813a5309ef081ae8f9e696a388ba8a4 /src
parentUpdated readme to inform that clang 3.4 is minimum required version. (#3158) (diff)
downloadcuberite-77bf00a5994cc4cbbca57d70fb8e761a2ea2757f.tar
cuberite-77bf00a5994cc4cbbca57d70fb8e761a2ea2757f.tar.gz
cuberite-77bf00a5994cc4cbbca57d70fb8e761a2ea2757f.tar.bz2
cuberite-77bf00a5994cc4cbbca57d70fb8e761a2ea2757f.tar.lz
cuberite-77bf00a5994cc4cbbca57d70fb8e761a2ea2757f.tar.xz
cuberite-77bf00a5994cc4cbbca57d70fb8e761a2ea2757f.tar.zst
cuberite-77bf00a5994cc4cbbca57d70fb8e761a2ea2757f.zip
Diffstat (limited to 'src')
-rw-r--r--src/Chunk.cpp10
-rw-r--r--src/ChunkData.cpp13
-rw-r--r--src/Mobs/Path.cpp2
3 files changed, 10 insertions, 15 deletions
diff --git a/src/Chunk.cpp b/src/Chunk.cpp
index ae3d218d5..ff0841440 100644
--- a/src/Chunk.cpp
+++ b/src/Chunk.cpp
@@ -2594,16 +2594,6 @@ bool cChunk::GetSignLines(int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_
BLOCKTYPE cChunk::GetBlock(int a_RelX, int a_RelY, int a_RelZ) const
{
- if (
- (a_RelX < 0) || (a_RelX >= Width) ||
- (a_RelY < 0) || (a_RelY >= Height) ||
- (a_RelZ < 0) || (a_RelZ >= Width)
- )
- {
- ASSERT(!"GetBlock(x, y, z) out of bounds!");
- return 0; // Clip
- }
-
return m_ChunkData.GetBlock(a_RelX, a_RelY, a_RelZ);
}
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;
}
diff --git a/src/Mobs/Path.cpp b/src/Mobs/Path.cpp
index 18090587e..1273b2517 100644
--- a/src/Mobs/Path.cpp
+++ b/src/Mobs/Path.cpp
@@ -250,7 +250,7 @@ bool cPath::StepOnce()
{
if (ProcessIfWalkable(CurrentCell->m_Location + Vector3i(0, y, 1), CurrentCell, NORMAL_G_COST))
{
- DoneWest = true;
+ DoneSouth = true;
if (y == 0)
{
WalkableSouth = true;