diff options
author | Howaner <franzi.moos@googlemail.com> | 2014-10-02 23:50:41 +0200 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2014-10-02 23:50:41 +0200 |
commit | 382e014ebcd44a72788bea8cdcec7f64861b063f (patch) | |
tree | 15cbd3a7730666619af341b147106e055c9395c7 /src/ChunkSender.cpp | |
parent | Merge pull request #1493 from Masy98/blocks (diff) | |
download | cuberite-382e014ebcd44a72788bea8cdcec7f64861b063f.tar cuberite-382e014ebcd44a72788bea8cdcec7f64861b063f.tar.gz cuberite-382e014ebcd44a72788bea8cdcec7f64861b063f.tar.bz2 cuberite-382e014ebcd44a72788bea8cdcec7f64861b063f.tar.lz cuberite-382e014ebcd44a72788bea8cdcec7f64861b063f.tar.xz cuberite-382e014ebcd44a72788bea8cdcec7f64861b063f.tar.zst cuberite-382e014ebcd44a72788bea8cdcec7f64861b063f.zip |
Diffstat (limited to 'src/ChunkSender.cpp')
-rw-r--r-- | src/ChunkSender.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/ChunkSender.cpp b/src/ChunkSender.cpp index a3151eb3f..0bdc0cf75 100644 --- a/src/ChunkSender.cpp +++ b/src/ChunkSender.cpp @@ -192,40 +192,37 @@ void cChunkSender::SendChunk(int a_ChunkX, int a_ChunkZ, cClientHandle * a_Clien ASSERT(m_World != NULL); // Ask the client if it still wants the chunk: - if (a_Client != NULL) + if ((a_Client != NULL) && !a_Client->WantsSendChunk(a_ChunkX, a_ChunkZ)) { - if (!a_Client->WantsSendChunk(a_ChunkX, a_ChunkZ)) - { - return; - } + return; } - + // If the chunk has no clients, no need to packetize it: if (!m_World->HasChunkAnyClients(a_ChunkX, a_ChunkZ)) { return; } - + // If the chunk is not valid, do nothing - whoever needs it has queued it for loading / generating if (!m_World->IsChunkValid(a_ChunkX, a_ChunkZ)) { return; } - + // If the chunk is not lighted, queue it for relighting and get notified when it's ready: if (!m_World->IsChunkLighted(a_ChunkX, a_ChunkZ)) { m_World->QueueLightChunk(a_ChunkX, a_ChunkZ, &m_Notify); return; } - + // Query and prepare chunk data: if (!m_World->GetChunkData(a_ChunkX, a_ChunkZ, *this)) { return; } cChunkDataSerializer Data(m_BlockTypes, m_BlockMetas, m_BlockLight, m_BlockSkyLight, m_BiomeMap); - + // Send: if (a_Client == NULL) { @@ -235,7 +232,7 @@ void cChunkSender::SendChunk(int a_ChunkX, int a_ChunkZ, cClientHandle * a_Clien { a_Client->SendChunkData(a_ChunkX, a_ChunkZ, Data); } - + // Send block-entity packets: for (sBlockCoords::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end(); ++itr) { @@ -249,7 +246,7 @@ void cChunkSender::SendChunk(int a_ChunkX, int a_ChunkZ, cClientHandle * a_Clien } } // for itr - m_Packets[] m_BlockEntities.clear(); - + // TODO: Send entity spawn packets } |