Line tracer invalid chunk fix
* Fixes #1230 * Additionally improved speed in some scenarios
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user