summaryrefslogtreecommitdiffstats
path: root/src/LineBlockTracer.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/LineBlockTracer.cpp57
1 files changed, 29 insertions, 28 deletions
diff --git a/src/LineBlockTracer.cpp b/src/LineBlockTracer.cpp
index b03652bab..f03e796d1 100644
--- a/src/LineBlockTracer.cpp
+++ b/src/LineBlockTracer.cpp
@@ -203,54 +203,55 @@ bool cLineBlockTracer::Item(cChunk * a_Chunk)
m_Callbacks->OnNoChunk();
return false;
}
- if (a_Chunk->IsValid())
+
+ // Move to next block
+ if (!MoveToNextBlock())
{
- BLOCKTYPE BlockType;
- NIBBLETYPE BlockMeta;
- int RelX = m_CurrentX - a_Chunk->GetPosX() * cChunkDef::Width;
- int RelZ = m_CurrentZ - a_Chunk->GetPosZ() * cChunkDef::Width;
- a_Chunk->GetBlockTypeMeta(RelX, m_CurrentY, RelZ, BlockType, BlockMeta);
- if (m_Callbacks->OnNextBlock(m_CurrentX, m_CurrentY, m_CurrentZ, BlockType, BlockMeta, m_CurrentFace))
- {
- // The callback terminated the trace
- return false;
- }
+ // We've reached the end
+ m_Callbacks->OnNoMoreHits();
+ return true;
}
- else
+
+ if ((m_CurrentY < 0) || (m_CurrentY >= cChunkDef::Height))
{
- if (m_Callbacks->OnNextBlockNoData(m_CurrentX, m_CurrentY, m_CurrentZ, m_CurrentFace))
+ // 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;
}
- }
-
- // Move to next block
- if (!MoveToNextBlock())
- {
- // We've reached the end
m_Callbacks->OnNoMoreHits();
return true;
}
-
+
// 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))
+
+ if (a_Chunk->IsValid())
{
- // 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))
+ BLOCKTYPE BlockType;
+ NIBBLETYPE BlockMeta;
+ int RelX = m_CurrentX - a_Chunk->GetPosX() * cChunkDef::Width;
+ int RelZ = m_CurrentZ - a_Chunk->GetPosZ() * cChunkDef::Width;
+ a_Chunk->GetBlockTypeMeta(RelX, m_CurrentY, RelZ, BlockType, BlockMeta);
+ if (m_Callbacks->OnNextBlock(m_CurrentX, m_CurrentY, m_CurrentZ, BlockType, BlockMeta, m_CurrentFace))
+ {
+ // The callback terminated the trace
+ return false;
+ }
+ }
+ else
+ {
+ if (m_Callbacks->OnNextBlockNoData(m_CurrentX, m_CurrentY, m_CurrentZ, m_CurrentFace))
{
// The callback terminated the trace
return false;
}
- m_Callbacks->OnNoMoreHits();
- return true;
}
}
}