From 97623fc634263eeff99e25b7527fde318108ea0d Mon Sep 17 00:00:00 2001 From: Howaner Date: Tue, 7 Oct 2014 21:36:01 +0200 Subject: Added distance check. --- src/ClientHandle.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 588a1caba..897ee9e9e 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -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()) || @@ -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()) || -- cgit v1.2.3