diff options
author | Mattes D <github@xoft.cz> | 2014-01-25 22:36:32 +0100 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-01-25 22:36:32 +0100 |
commit | cdcad2237a91dfd18cde539c300034f84bc8c07b (patch) | |
tree | 5f3266637858980f29ff3ee4cc4c116e575797d3 /src/Generating/ChunkGenerator.cpp | |
parent | Merge pull request #583 from mc-server/ChangeToPolarSSL (diff) | |
parent | Did what xoft recommended (diff) | |
download | cuberite-cdcad2237a91dfd18cde539c300034f84bc8c07b.tar cuberite-cdcad2237a91dfd18cde539c300034f84bc8c07b.tar.gz cuberite-cdcad2237a91dfd18cde539c300034f84bc8c07b.tar.bz2 cuberite-cdcad2237a91dfd18cde539c300034f84bc8c07b.tar.lz cuberite-cdcad2237a91dfd18cde539c300034f84bc8c07b.tar.xz cuberite-cdcad2237a91dfd18cde539c300034f84bc8c07b.tar.zst cuberite-cdcad2237a91dfd18cde539c300034f84bc8c07b.zip |
Diffstat (limited to 'src/Generating/ChunkGenerator.cpp')
-rw-r--r-- | src/Generating/ChunkGenerator.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Generating/ChunkGenerator.cpp b/src/Generating/ChunkGenerator.cpp index baa5b76b8..ef38f1399 100644 --- a/src/Generating/ChunkGenerator.cpp +++ b/src/Generating/ChunkGenerator.cpp @@ -201,7 +201,7 @@ void cChunkGenerator::Execute(void) while (!m_ShouldTerminate) { cCSLock Lock(m_CS); - while (m_Queue.size() == 0) + while (m_Queue.empty()) { if ((NumChunksGenerated > 16) && (clock() - LastReportTick > CLOCKS_PER_SEC)) { @@ -221,6 +221,13 @@ void cChunkGenerator::Execute(void) LastReportTick = clock(); } + if (m_Queue.empty()) + { + // Sometimes the queue remains empty + // If so, we can't do any front() operations on it! + continue; + } + cChunkCoords coords = m_Queue.front(); // Get next coord from queue m_Queue.erase( m_Queue.begin() ); // Remove coordinate from queue bool SkipEnabled = (m_Queue.size() > QUEUE_SKIP_LIMIT); |