Merge pull request #1971 from mc-server/worktycho-patch-1
Move chunk position accesses after the chunk validity checks
This commit is contained in:
commit
4d459d39ee
@ -264,12 +264,14 @@ bool cMonster::EnsureProperDestination(cChunk & a_Chunk)
|
|||||||
cChunk * Chunk = a_Chunk.GetNeighborChunk(m_FinalDestination.x, m_FinalDestination.z);
|
cChunk * Chunk = a_Chunk.GetNeighborChunk(m_FinalDestination.x, m_FinalDestination.z);
|
||||||
BLOCKTYPE BlockType;
|
BLOCKTYPE BlockType;
|
||||||
NIBBLETYPE BlockMeta;
|
NIBBLETYPE BlockMeta;
|
||||||
int RelX = m_FinalDestination.x - Chunk->GetPosX() * cChunkDef::Width;
|
|
||||||
int RelZ = m_FinalDestination.z - Chunk->GetPosZ() * cChunkDef::Width;
|
|
||||||
if ((Chunk == nullptr) || !Chunk->IsValid())
|
if ((Chunk == nullptr) || !Chunk->IsValid())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int RelX = m_FinalDestination.x - Chunk->GetPosX() * cChunkDef::Width;
|
||||||
|
int RelZ = m_FinalDestination.z - Chunk->GetPosZ() * cChunkDef::Width;
|
||||||
|
|
||||||
// If destination in the air, go down to the lowest air block.
|
// If destination in the air, go down to the lowest air block.
|
||||||
while (m_FinalDestination.y > 0)
|
while (m_FinalDestination.y > 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user