From f1a23ac811cbdf5491db00cf2e81f933453fdef1 Mon Sep 17 00:00:00 2001 From: Condorra Date: Sun, 1 Oct 2023 19:18:49 +1100 Subject: [PATCH] Fix lmap display for se/nw links --- .../src/message_handler/user_commands/map.rs | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/blastmud_game/src/message_handler/user_commands/map.rs b/blastmud_game/src/message_handler/user_commands/map.rs index 6257b88..9eb827e 100644 --- a/blastmud_game/src/message_handler/user_commands/map.rs +++ b/blastmud_game/src/message_handler/user_commands/map.rs @@ -179,6 +179,7 @@ pub fn render_lmap( Some(_) => buf.push('-'), } } + buf.push('\n'); for x in min_x..max_x { let mut coord = room::GridCoords { x, y, z: my_loc.z }; let coord_room = room::room_map_by_zloc().get(&(&room.zone, &coord)); @@ -195,20 +196,20 @@ pub fn render_lmap( .find(|ex| ex.direction == Direction::SOUTHEAST) }) .is_some(); - coord.y += 1; + coord.x += 1; let coord_room_s = room::room_map_by_zloc().get(&(&room.zone, &coord)); - let has_ne = coord_room_s + let has_sw = coord_room_s .and_then(|r| { r.exits .iter() - .find(|ex| ex.direction == Direction::NORTHEAST) + .find(|ex| ex.direction == Direction::SOUTHWEST) }) .is_some(); - if has_se && has_ne { + if has_se && has_sw { buf.push('X'); } else if has_se { buf.push('\\'); - } else if has_ne { + } else if has_sw { buf.push('/'); } else { buf.push(' '); @@ -272,6 +273,10 @@ pub fn render_lmap_dynroom<'l, 'm>( room.name, )); } + match room.exits.iter().find(|ex| ex.direction == Direction::EAST) { + None => buf.push(' '), + Some(_) => buf.push('-'), + } } } else if let Some(room) = coord_room { if room.should_caption { @@ -311,6 +316,7 @@ pub fn render_lmap_dynroom<'l, 'm>( buf.push_str(" "); } } + buf.push('\n'); for x in min_x..max_x { let mut coord = room::GridCoords { x, y, z: my_loc.z }; let coord_room: Option<&'l dynzone::Dynroom> = zone @@ -337,27 +343,29 @@ pub fn render_lmap_dynroom<'l, 'm>( }) .is_some() || (main_exit == Some(&(coord.clone(), Direction::NORTHWEST))); - coord.y += 1; + coord.x += 1; let coord_room_s = zone .dyn_rooms .iter() .find(|(_, dr)| { - dr.grid_coords.x == x && dr.grid_coords.y == y && dr.grid_coords.z == my_loc.z + dr.grid_coords.x == coord.x + && dr.grid_coords.y == coord.y + && dr.grid_coords.z == my_loc.z }) .map(|(_, r)| r); - let has_ne = coord_room_s + let has_sw = coord_room_s .and_then(|r| { r.exits .iter() - .find(|ex| ex.direction == Direction::NORTHEAST) + .find(|ex| ex.direction == Direction::SOUTHWEST) }) .is_some() - || (main_exit == Some(&(coord, Direction::SOUTHWEST))); - if has_se && has_ne { + || (main_exit == Some(&(coord, Direction::NORTHEAST))); + if has_se && has_sw { buf.push('X'); } else if has_se { buf.push('\\'); - } else if has_ne { + } else if has_sw { buf.push('/'); } else { buf.push(' ');