Determines whether this location is adjacent to the specified location, including diagonally. Note that squares are not adjacent to themselves, and squares on different planets are not adjacent to each other.
(&self, o: MapLocation)
| 261 | /// including diagonally. Note that squares are not adjacent to themselves, |
| 262 | /// and squares on different planets are not adjacent to each other. |
| 263 | pub fn is_adjacent_to(&self, o: MapLocation) -> bool { |
| 264 | if self.planet != o.planet { |
| 265 | return false; |
| 266 | } |
| 267 | let dist_squared = self.distance_squared_to(o); |
| 268 | dist_squared <= 2 && dist_squared != 0 |
| 269 | } |
| 270 | |
| 271 | /// Whether this location is within the distance squared range of the |
| 272 | /// specified location, inclusive. False for locations on different planets. |
no test coverage detected