Fix lmap display for se/nw links

This commit is contained in:
Condorra 2023-10-01 19:18:49 +11:00
parent 472bdb4f0e
commit f1a23ac811

View File

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