From 37bb4ac5645b82ab1401dc72c79eb8adf9041fcf Mon Sep 17 00:00:00 2001 From: CoCoSol007 Date: Fri, 16 Feb 2024 22:01:11 +0100 Subject: [PATCH] remove range --- crates/border-wars/src/map/hex.rs | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/crates/border-wars/src/map/hex.rs b/crates/border-wars/src/map/hex.rs index 15d9ce4..ea2a8ed 100644 --- a/crates/border-wars/src/map/hex.rs +++ b/crates/border-wars/src/map/hex.rs @@ -309,37 +309,6 @@ impl HexPosition { x.abs() + y.abs() + (x + y).abs() / T::TWO } - /// Returns all positions within a given `range` from the current - /// `HexPosition`. - /// - /// This function iterates over the possible q and r values within the - /// specified range. - /// Note that the original position is also returned. - /// - /// For more details, refer to: https://www.redblobgames.com/grids/hexagons/#range - /// - /// # Example - /// - /// ```no_run - /// use border_wars::map::hex::HexPosition; - /// - /// let position = HexPosition(0, 0); - /// let range = 1; - /// - /// let positions = position.range(range); - /// - /// assert_eq!(positions.len(), 7); - /// ``` - pub fn range(&self, range: isize) -> Vec { - let mut result_positions = Vec::new(); - for q in -range..=range { - for r in Number::min(-range, -q - range)..=Number::min(range, -q + range) { - result_positions.push(Self(T::from_isize(q), T::from_isize(r))); - } - } - result_positions - } - /// Returns the hexagonal ring of the given radius. /// If you want to learn more about hexagonal grids, check the /// [documentation](https://www.redblobgames.com/grids/hexagons/#rings)