+void ChunkLoader::LoadN(std::size_t n) {
+ std::size_t end = std::min(n, ToLoad());
+ for (std::size_t i = 0; i < end; ++i) {
+ LoadOne();
+ }
+}
+
+bool ChunkLoader::LoadOne() {
+ if (to_load.empty()) return false;
+
+ // take position of next chunk in queue
+ Chunk::Pos pos(to_load.front());
+ to_load.pop_front();
+
+ // look if the same chunk was already generated and still lingering