From b0988e65aadc1a9d33065cf6afefc05dbf768ef8 Mon Sep 17 00:00:00 2001 From: Howaner Date: Tue, 21 Oct 2014 17:35:23 +0200 Subject: Use two lists and 2 chunk send prioritys. --- src/ClientHandle.cpp | 41 ----------------------------------------- 1 file changed, 41 deletions(-) (limited to 'src/ClientHandle.cpp') diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 28fcb0d37..ce5056f30 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -469,47 +469,6 @@ bool cClientHandle::StreamNextChunk(void) } } - // Medium priority: Load the chunks that are behind the player - LookVector = m_Player->GetLookVector() * -1; - for (int Range = 0; Range < 3; Range++) - { - Vector3d Vector = Position + LookVector * cChunkDef::Width * Range; - - // Get the chunk from the x/z coords. - int RangeX, RangeZ = 0; - cChunkDef::BlockToChunk(FloorC(Vector.x), FloorC(Vector.z), RangeX, RangeZ); - - for (size_t X = 0; X < 7; X++) - { - for (size_t Z = 0; Z < 7; Z++) - { - int ChunkX = RangeX + ((X >= 4) ? (3 - X) : X); - 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()) || - (std::find(m_LoadedChunks.begin(), m_LoadedChunks.end(), Coords) != m_LoadedChunks.end()) - ) - { - continue; - } - - // Unloaded chunk found -> Send it to the client. - Lock.Unlock(); - StreamChunk(ChunkX, ChunkZ, cChunkSender::E_CHUNK_PRIORITY_MEDIUM); - return false; - } - } - } - // Low priority: Add all chunks that are in range. (From the center out to the edge) for (int d = 0; d <= m_ViewDistance; ++d) // cycle through (square) distance, from nearest to furthest { -- cgit v1.2.3