mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Ensure cancelled chunks are not loaded into the terrain
This commit is contained in:
parent
d73ec09d83
commit
9030fee99f
@ -65,14 +65,17 @@ impl ChunkGenerator {
|
||||
}
|
||||
|
||||
pub fn recv_new_chunk(&mut self) -> Option<ChunkGenResult> {
|
||||
if let Ok((key, res)) = self.chunk_rx.try_recv() {
|
||||
self.pending_chunks.remove(&key);
|
||||
self.metrics.chunks_served.inc();
|
||||
// TODO: do anything else if res is an Err?
|
||||
Some((key, res))
|
||||
} else {
|
||||
None
|
||||
// Make sure chunk wasn't cancelled and if it was check to see if there are more
|
||||
// chunks to receive
|
||||
while let Ok((key, res)) = self.chunk_rx.try_recv() {
|
||||
if self.pending_chunks.remove(&key).is_some() {
|
||||
self.metrics.chunks_served.inc();
|
||||
// TODO: do anything else if res is an Err?
|
||||
return Some((key, res));
|
||||
}
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
|
||||
pub fn pending_chunks(&self) -> impl Iterator<Item = Vec2<i32>> + '_ {
|
||||
|
Loading…
Reference in New Issue
Block a user