visibile area highlighting

This commit is contained in:
2020-03-29 20:36:52 -04:00
parent bafe3fcbc9
commit 222e2e5e74
3 changed files with 19 additions and 25 deletions

View File

@@ -14,6 +14,7 @@ pub struct Map {
pub width: i32,
pub height: i32,
pub revealed_tiles: Vec<bool>,
pub visible_tiles: Vec<bool>,
}
impl Map {
@@ -55,6 +56,7 @@ impl Map {
width: 80,
height: 50,
revealed_tiles: vec![false; 80 * 50],
visible_tiles: vec![false; 80 * 50],
};
const MAX_ROOMS: i32 = 30;
@@ -82,18 +84,10 @@ impl Map {
let r2_center = map.rooms[map.rooms.len() - 1].center();
if rng.range(0, 2) == 1 {
map.apply_horizontal_tunnel(r1_center.0, r2_center.0, r1_center.1);
map.apply_vertical_tunnel(
r2_center.0,
r1_center.1,
r2_center.1,
);
map.apply_vertical_tunnel(r2_center.0, r1_center.1, r2_center.1);
} else {
map.apply_vertical_tunnel(r1_center.0, r1_center.1, r2_center.1);
map.apply_horizontal_tunnel(
r1_center.0,
r2_center.0,
r2_center.1,
);
map.apply_horizontal_tunnel(r1_center.0, r2_center.0, r2_center.1);
}
}
map.rooms.push(new_room);