From 9b124e5640e7c946378114d911c6e0bf6ba50776 Mon Sep 17 00:00:00 2001 From: Nolan Darilek Date: Sun, 16 May 2021 16:50:20 -0500 Subject: [PATCH] Put direction before distance. --- src/core.rs | 4 ++-- src/exploration.rs | 2 +- src/visibility.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core.rs b/src/core.rs index dacdacf..c2b597f 100644 --- a/src/core.rs +++ b/src/core.rs @@ -293,13 +293,13 @@ pub trait PointLike { MovementDirection::new(heading.to_degrees()) } - fn distance_and_direction(&self, other: &dyn PointLike) -> String { + fn direction_and_distance(&self, other: &dyn PointLike) -> String { let mut tokens: Vec = vec![]; let distance = self.distance(other).round() as i32; if distance > 0 { let tile_or_tiles = if distance == 1 { "tile" } else { "tiles" }; let direction: String = self.direction(other).into(); - tokens.push(format!("{} {} {}", distance, tile_or_tiles, direction)); + tokens.push(format!("{} {} {}", direction, distance, tile_or_tiles)); } tokens.join(" ") } diff --git a/src/exploration.rs b/src/exploration.rs index fdcdaa7..f3e712f 100644 --- a/src/exploration.rs +++ b/src/exploration.rs @@ -341,7 +341,7 @@ fn exploration_changed_announcement( } else { "Unknown".to_string() }; - let mut tokens: Vec = vec![coordinates.distance_and_direction(exploring)]; + let mut tokens: Vec = vec![coordinates.direction_and_distance(exploring)]; if fog_of_war { tokens.push("in the fog of war".into()); } diff --git a/src/visibility.rs b/src/visibility.rs index d63c829..5974ac6 100644 --- a/src/visibility.rs +++ b/src/visibility.rs @@ -251,7 +251,7 @@ fn log_visible( if !seen.contains(&*entity) { let name = name.to_string(); let location = - coordinates.distance_and_direction(viewed_coordinates); + coordinates.direction_and_distance(viewed_coordinates); log.push(format!("{}: {}", name, location)); } new_seen.insert(*entity);