summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ClientHandle.cpp12
1 files changed, 12 insertions, 0 deletions
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()) ||