Added distance check.
This commit is contained in:
parent
b493beb3bb
commit
97623fc634
@ -443,6 +443,12 @@ bool cClientHandle::StreamNextChunk(void)
|
|||||||
int ChunkZ = RangeZ + ((Z >= 4) ? (3 - Z) : Z);
|
int ChunkZ = RangeZ + ((Z >= 4) ? (3 - Z) : Z);
|
||||||
cChunkCoords Coords(ChunkX, ChunkZ);
|
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 the chunk already loading/loaded -> skip
|
||||||
if (
|
if (
|
||||||
(std::find(m_ChunksToSend.begin(), m_ChunksToSend.end(), Coords) != m_ChunksToSend.end()) ||
|
(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);
|
int ChunkZ = RangeZ + ((Z >= 4) ? (3 - Z) : Z);
|
||||||
cChunkCoords Coords(ChunkX, ChunkZ);
|
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 the chunk already loading/loaded -> skip
|
||||||
if (
|
if (
|
||||||
(std::find(m_ChunksToSend.begin(), m_ChunksToSend.end(), Coords) != m_ChunksToSend.end()) ||
|
(std::find(m_ChunksToSend.begin(), m_ChunksToSend.end(), Coords) != m_ChunksToSend.end()) ||
|
||||||
|
Loading…
x
Reference in New Issue
Block a user