diff --git a/src/dreammaker/dmi.rs b/src/dreammaker/dmi.rs index 80e939fc..cd1939c9 100644 --- a/src/dreammaker/dmi.rs +++ b/src/dreammaker/dmi.rs @@ -20,6 +20,10 @@ pub enum Dir { } impl Dir { + pub const CARDINALS: &'static [Dir] = &[Dir::North, Dir::South, Dir::East, Dir::West]; + pub const DIAGONALS: &'static [Dir] = &[Dir::Northeast, Dir::Northwest, Dir::Southeast, Dir::Southwest]; + pub const ALL: &'static [Dir] = &[Dir::North, Dir::South, Dir::East, Dir::West, Dir::Northeast, Dir::Northwest, Dir::Southeast, Dir::Southwest]; + /// Attempt to build a direction from its integer representation. pub fn from_int(int: i32) -> Option { Some(match int { diff --git a/src/tools/render_passes/icon_smoothing.rs b/src/tools/render_passes/icon_smoothing.rs index 1f293019..b95cb05d 100644 --- a/src/tools/render_passes/icon_smoothing.rs +++ b/src/tools/render_passes/icon_smoothing.rs @@ -79,7 +79,7 @@ fn calculate_adjacencies(objtree: &ObjectTree, neighborhood: &Neighborhood, atom } }; - for &dir in &[Dir::South, Dir::North, Dir::East, Dir::West] { + for &dir in Dir::CARDINALS { adjacencies |= check_one(dir, 1 << dir.to_int()); }