diff --git a/lib/mw_common/src/algo.rs b/lib/mw_common/src/algo.rs index 13fd29c..fd54bfc 100644 --- a/lib/mw_common/src/algo.rs +++ b/lib/mw_common/src/algo.rs @@ -6,17 +6,26 @@ use crate::grid::{Coord, Pos}; pub enum FloodSelect { /// Tile does not qualify No, + /// Do no more iterations + Abort, /// Add tile to end of queue Yes, /// Add tile to start of queue (next tile to check) YesPrio, - /// Do no more iterations - Abort, } /// Type of the queue data structure (re)used for `flood` pub type FloodQ = std::collections::VecDeque; +impl From for bool { + fn from(value: FloodSelect) -> Self { + match value { + FloodSelect::No | FloodSelect::Abort => false, + FloodSelect::Yes | FloodSelect::YesPrio => true, + } + } +} + /// Floodfill algorithm /// /// Initialize `q` with starting tiles to expand from.