Skip to content

Commit

Permalink
Added distance check.
Browse files Browse the repository at this point in the history
  • Loading branch information
Howaner committed Oct 7, 2014
1 parent b493beb commit 97623fc
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/ClientHandle.cpp
Expand Up @@ -443,6 +443,12 @@ bool cClientHandle::StreamNextChunk(void)
int ChunkZ = RangeZ + ((Z >= 4) ? (3 - Z) : Z);
cChunkCoords Coords(ChunkX, ChunkZ);

// Checks if the chunk is in distance
if ((Diff(ChunkX, ChunkPosX) > m_ViewDistance) || (Diff(ChunkZ, ChunkPosZ) > m_ViewDistance))
{
continue;
}

// If the chunk already loading/loaded -> skip
if (
(std::find(m_ChunksToSend.begin(), m_ChunksToSend.end(), Coords) != m_ChunksToSend.end()) ||
Expand Down Expand Up @@ -478,6 +484,12 @@ bool cClientHandle::StreamNextChunk(void)
int ChunkZ = RangeZ + ((Z >= 4) ? (3 - Z) : Z);
cChunkCoords Coords(ChunkX, ChunkZ);

// Checks if the chunk is in distance
if ((Diff(ChunkX, ChunkPosX) > m_ViewDistance) || (Diff(ChunkZ, ChunkPosZ) > m_ViewDistance))
{
continue;
}

// If the chunk already loading/loaded -> skip
if (
(std::find(m_ChunksToSend.begin(), m_ChunksToSend.end(), Coords) != m_ChunksToSend.end()) ||
Expand Down

0 comments on commit 97623fc

Please sign in to comment.