summaryrefslogtreecommitdiffstats
path: root/src/LineBlockTracer.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-07-22 11:24:28 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-07-22 11:24:28 +0200
commit3385ed56b86a7816892e199fdda177ebb3a33966 (patch)
treee4ebda8e1fc245e9a84c3c4b363c05bbbad3a85f /src/LineBlockTracer.cpp
parentSuggestions (diff)
parentUpdated prefabs to current Gallery content. (diff)
downloadcuberite-3385ed56b86a7816892e199fdda177ebb3a33966.tar
cuberite-3385ed56b86a7816892e199fdda177ebb3a33966.tar.gz
cuberite-3385ed56b86a7816892e199fdda177ebb3a33966.tar.bz2
cuberite-3385ed56b86a7816892e199fdda177ebb3a33966.tar.lz
cuberite-3385ed56b86a7816892e199fdda177ebb3a33966.tar.xz
cuberite-3385ed56b86a7816892e199fdda177ebb3a33966.tar.zst
cuberite-3385ed56b86a7816892e199fdda177ebb3a33966.zip
Diffstat (limited to '')
-rw-r--r--src/LineBlockTracer.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/LineBlockTracer.cpp b/src/LineBlockTracer.cpp
index 2395aa43e..f03e796d1 100644
--- a/src/LineBlockTracer.cpp
+++ b/src/LineBlockTracer.cpp
@@ -212,6 +212,26 @@ bool cLineBlockTracer::Item(cChunk * a_Chunk)
return true;
}
+ if ((m_CurrentY < 0) || (m_CurrentY >= cChunkDef::Height))
+ {
+ // We've gone out of the world, that's the end of this trace
+ double IntersectX, IntersectZ;
+ CalcXZIntersection(m_CurrentY, IntersectX, IntersectZ);
+ if (m_Callbacks->OnOutOfWorld(IntersectX, m_CurrentY, IntersectZ))
+ {
+ // The callback terminated the trace
+ return false;
+ }
+ m_Callbacks->OnNoMoreHits();
+ return true;
+ }
+
+ // Update the current chunk
+ if (a_Chunk != NULL)
+ {
+ a_Chunk = a_Chunk->GetNeighborChunk(m_CurrentX, m_CurrentZ);
+ }
+
if (a_Chunk->IsValid())
{
BLOCKTYPE BlockType;
@@ -233,26 +253,6 @@ bool cLineBlockTracer::Item(cChunk * a_Chunk)
return false;
}
}
-
- // Update the current chunk
- if (a_Chunk != NULL)
- {
- a_Chunk = a_Chunk->GetNeighborChunk(m_CurrentX, m_CurrentZ);
- }
-
- if ((m_CurrentY < 0) || (m_CurrentY >= cChunkDef::Height))
- {
- // We've gone out of the world, that's the end of this trace
- double IntersectX, IntersectZ;
- CalcXZIntersection(m_CurrentY, IntersectX, IntersectZ);
- if (m_Callbacks->OnOutOfWorld(IntersectX, m_CurrentY, IntersectZ))
- {
- // The callback terminated the trace
- return false;
- }
- m_Callbacks->OnNoMoreHits();
- return true;
- }
}
}