diff options
author | Howaner <franzi.moos@googlemail.com> | 2014-10-06 21:27:53 +0200 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2014-10-06 21:27:53 +0200 |
commit | b493beb3bbac05d0402a6e388a61bf446c6c00ff (patch) | |
tree | f8ded1c4d42bbd398285c78016d5139d9c5ef56c /src/ChunkSender.cpp | |
parent | Merge branch 'master' into ChunkLoader (diff) | |
download | cuberite-b493beb3bbac05d0402a6e388a61bf446c6c00ff.tar cuberite-b493beb3bbac05d0402a6e388a61bf446c6c00ff.tar.gz cuberite-b493beb3bbac05d0402a6e388a61bf446c6c00ff.tar.bz2 cuberite-b493beb3bbac05d0402a6e388a61bf446c6c00ff.tar.lz cuberite-b493beb3bbac05d0402a6e388a61bf446c6c00ff.tar.xz cuberite-b493beb3bbac05d0402a6e388a61bf446c6c00ff.tar.zst cuberite-b493beb3bbac05d0402a6e388a61bf446c6c00ff.zip |
Diffstat (limited to 'src/ChunkSender.cpp')
-rw-r--r-- | src/ChunkSender.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/ChunkSender.cpp b/src/ChunkSender.cpp index 0bdc0cf75..2a953db1f 100644 --- a/src/ChunkSender.cpp +++ b/src/ChunkSender.cpp @@ -91,17 +91,22 @@ void cChunkSender::ChunkReady(int a_ChunkX, int a_ChunkZ) -void cChunkSender::QueueSendChunkTo(int a_ChunkX, int a_ChunkZ, cClientHandle * a_Client) +void cChunkSender::QueueSendChunkTo(int a_ChunkX, int a_ChunkZ, eChunkPriority a_Priority, cClientHandle * a_Client) { ASSERT(a_Client != NULL); { + sSendChunk Chunk(a_ChunkX, a_ChunkZ, a_Priority, a_Client); + cCSLock Lock(m_CS); - if (std::find(m_SendChunks.begin(), m_SendChunks.end(), sSendChunk(a_ChunkX, a_ChunkZ, a_Client)) != m_SendChunks.end()) + if (std::find(m_SendChunks.begin(), m_SendChunks.end(), Chunk) != m_SendChunks.end()) { // Already queued, bail out return; } - m_SendChunks.push_back(sSendChunk(a_ChunkX, a_ChunkZ, a_Client)); + m_SendChunks.push_back(Chunk); + + // Sort the list: + m_SendChunks.sort(); } m_evtQueue.Set(); } @@ -169,7 +174,7 @@ void cChunkSender::Execute(void) sSendChunk Chunk(m_SendChunks.front()); m_SendChunks.pop_front(); Lock.Unlock(); - + SendChunk(Chunk.m_ChunkX, Chunk.m_ChunkZ, Chunk.m_Client); } Lock.Lock(); |