Registry refactor and clear queues on board entry
This commit is contained in:
@@ -585,6 +585,15 @@ impl Board {
|
||||
fn terrain_layer_at(&self, x: usize, y: usize) -> Option<usize> {
|
||||
(0..self.layers.len()).find(|&z| self.get(z, x, y).1 != Archetype::Empty)
|
||||
}
|
||||
|
||||
/// Clear the queues of all objects on this board: called when entering a board, objects
|
||||
/// don't retain their state across board visits (they get initialized again, but can
|
||||
/// store things in the board registry)
|
||||
pub fn clear_all_queues(&mut self) {
|
||||
for obj in self.objects.values_mut() {
|
||||
obj.queue.clear()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in New Issue
Block a user