summaryrefslogtreecommitdiffstats
path: root/source/ChunkSender.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-03-11 11:48:20 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-03-11 11:48:20 +0100
commitaf44154ff57ee725903d58c94cbba12413ddeb41 (patch)
tree688bb37acf3c9795266e3f6513e39056808128a3 /source/ChunkSender.cpp
parentAnvil format: fixed loading with XZY ordering (diff)
downloadcuberite-af44154ff57ee725903d58c94cbba12413ddeb41.tar
cuberite-af44154ff57ee725903d58c94cbba12413ddeb41.tar.gz
cuberite-af44154ff57ee725903d58c94cbba12413ddeb41.tar.bz2
cuberite-af44154ff57ee725903d58c94cbba12413ddeb41.tar.lz
cuberite-af44154ff57ee725903d58c94cbba12413ddeb41.tar.xz
cuberite-af44154ff57ee725903d58c94cbba12413ddeb41.tar.zst
cuberite-af44154ff57ee725903d58c94cbba12413ddeb41.zip
Diffstat (limited to 'source/ChunkSender.cpp')
-rw-r--r--source/ChunkSender.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/source/ChunkSender.cpp b/source/ChunkSender.cpp
index ed650e1f8..cb4340f25 100644
--- a/source/ChunkSender.cpp
+++ b/source/ChunkSender.cpp
@@ -67,6 +67,8 @@ void cChunkSender::QueueSendChunkTo(int a_ChunkX, int a_ChunkY, int a_ChunkZ, cC
ASSERT(a_Client != NULL);
{
cCSLock Lock(m_CS);
+ // It should not be already queued:
+ ASSERT(std::find(m_SendChunks.begin(), m_SendChunks.end(), sSendChunk(a_ChunkX, a_ChunkY, a_ChunkZ, a_Client)) == m_SendChunks.end());
m_SendChunks.push_back(sSendChunk(a_ChunkX, a_ChunkY, a_ChunkZ, a_Client));
}
m_evtQueue.Set();
@@ -144,6 +146,15 @@ void cChunkSender::SendChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ, cClientHa
{
ASSERT(m_World != NULL);
+ // Ask the client if it still wants the chunk:
+ if (a_Client != NULL)
+ {
+ if (!a_Client->WantsSendChunk(a_ChunkX, a_ChunkY, a_ChunkZ))
+ {
+ return;
+ }
+ }
+
// Prepare MapChunk packets:
if( !m_World->GetChunkData(a_ChunkX, a_ChunkY, a_ChunkZ, *this) )
{