Put direction before distance.

This commit is contained in:
Nolan Darilek 2021-05-16 16:50:20 -05:00
parent 64e763a840
commit 9b124e5640
3 changed files with 4 additions and 4 deletions

View File

@ -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<String> = 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(" ")
}

View File

@ -341,7 +341,7 @@ fn exploration_changed_announcement(
} else {
"Unknown".to_string()
};
let mut tokens: Vec<String> = vec![coordinates.distance_and_direction(exploring)];
let mut tokens: Vec<String> = vec![coordinates.direction_and_distance(exploring)];
if fog_of_war {
tokens.push("in the fog of war".into());
}

View File

@ -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);