diff options
author | worktycho <work.tycho@gmail.com> | 2015-06-07 21:45:47 +0200 |
---|---|---|
committer | worktycho <work.tycho@gmail.com> | 2015-06-07 21:45:47 +0200 |
commit | adfbc42c021e1bcfcb355933c0fd784306ce0e18 (patch) | |
tree | 57deef6f15be95c6f1f1e27186a9f7ea8a0e2cf6 /src/ClientHandle.cpp | |
parent | Merge pull request #2210 from nounoursheureux/bucket-craft (diff) | |
download | cuberite-adfbc42c021e1bcfcb355933c0fd784306ce0e18.tar cuberite-adfbc42c021e1bcfcb355933c0fd784306ce0e18.tar.gz cuberite-adfbc42c021e1bcfcb355933c0fd784306ce0e18.tar.bz2 cuberite-adfbc42c021e1bcfcb355933c0fd784306ce0e18.tar.lz cuberite-adfbc42c021e1bcfcb355933c0fd784306ce0e18.tar.xz cuberite-adfbc42c021e1bcfcb355933c0fd784306ce0e18.tar.zst cuberite-adfbc42c021e1bcfcb355933c0fd784306ce0e18.zip |
Diffstat (limited to 'src/ClientHandle.cpp')
-rw-r--r-- | src/ClientHandle.cpp | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 9ed89e0a3..d89f7ab77 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -456,7 +456,7 @@ bool cClientHandle::StreamNextChunk(void) // If the chunk already loading / loaded -> skip if ( - (m_ChunksToSend.find(Coords) != m_ChunksToSend.end()) || + (std::find(m_ChunksToSend.begin(), m_ChunksToSend.end(), Coords) != m_ChunksToSend.end()) || (std::find(m_LoadedChunks.begin(), m_LoadedChunks.end(), Coords) != m_LoadedChunks.end()) ) { @@ -494,7 +494,7 @@ bool cClientHandle::StreamNextChunk(void) // If the chunk already loading / loaded -> skip if ( - (m_ChunksToSend.find(Coords) != m_ChunksToSend.end()) || + (std::find(m_ChunksToSend.begin(), m_ChunksToSend.end(), Coords) != m_ChunksToSend.end()) || (std::find(m_LoadedChunks.begin(), m_LoadedChunks.end(), Coords) != m_LoadedChunks.end()) ) { @@ -541,7 +541,7 @@ void cClientHandle::UnloadOutOfRangeChunks(void) } } - for (auto itr = m_ChunksToSend.begin(); itr != m_ChunksToSend.end();) + for (cChunkCoordsList::iterator itr = m_ChunksToSend.begin(); itr != m_ChunksToSend.end();) { int DiffX = Diff((*itr).m_ChunkX, ChunkPosX); int DiffZ = Diff((*itr).m_ChunkZ, ChunkPosZ); @@ -583,7 +583,7 @@ void cClientHandle::StreamChunk(int a_ChunkX, int a_ChunkZ, cChunkSender::eChunk { cCSLock Lock(m_CSChunkLists); m_LoadedChunks.push_back(cChunkCoords(a_ChunkX, a_ChunkZ)); - m_ChunksToSend.emplace(a_ChunkX, a_ChunkZ); + m_ChunksToSend.push_back(cChunkCoords(a_ChunkX, a_ChunkZ)); } World->SendChunkTo(a_ChunkX, a_ChunkZ, a_Priority, this); } @@ -2179,12 +2179,15 @@ void cClientHandle::SendChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataSerializ bool Found = false; { cCSLock Lock(m_CSChunkLists); - auto itr = m_ChunksToSend.find(cChunkCoords{a_ChunkX, a_ChunkZ}); - if (itr != m_ChunksToSend.end()) + for (cChunkCoordsList::iterator itr = m_ChunksToSend.begin(); itr != m_ChunksToSend.end(); ++itr) { - m_ChunksToSend.erase(itr); - Found = true; - } + if ((itr->m_ChunkX == a_ChunkX) && (itr->m_ChunkZ == a_ChunkZ)) + { + m_ChunksToSend.erase(itr); + Found = true; + break; + } + } // for itr - m_ChunksToSend[] } if (!Found) { @@ -2947,7 +2950,7 @@ bool cClientHandle::WantsSendChunk(int a_ChunkX, int a_ChunkZ) } cCSLock Lock(m_CSChunkLists); - return m_ChunksToSend.find(cChunkCoords(a_ChunkX, a_ChunkZ)) != m_ChunksToSend.end(); + return (std::find(m_ChunksToSend.begin(), m_ChunksToSend.end(), cChunkCoords(a_ChunkX, a_ChunkZ)) != m_ChunksToSend.end()); } @@ -2963,9 +2966,9 @@ void cClientHandle::AddWantedChunk(int a_ChunkX, int a_ChunkZ) LOGD("Adding chunk [%d, %d] to wanted chunks for client %p", a_ChunkX, a_ChunkZ, this); cCSLock Lock(m_CSChunkLists); - if (m_ChunksToSend.find(cChunkCoords(a_ChunkX, a_ChunkZ)) == m_ChunksToSend.end()) + if (std::find(m_ChunksToSend.begin(), m_ChunksToSend.end(), cChunkCoords(a_ChunkX, a_ChunkZ)) == m_ChunksToSend.end()) { - m_ChunksToSend.emplace(a_ChunkX, a_ChunkZ); + m_ChunksToSend.push_back(cChunkCoords(a_ChunkX, a_ChunkZ)); } } |