diff options
Diffstat (limited to 'dungeon/src/map.rs')
| -rw-r--r-- | dungeon/src/map.rs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/dungeon/src/map.rs b/dungeon/src/map.rs index 9e43faf..5004dd7 100644 --- a/dungeon/src/map.rs +++ b/dungeon/src/map.rs @@ -28,8 +28,10 @@ pub const TILE_COUNT: usize = MAP_SIZE_USIZE * MAP_SIZE_USIZE; pub enum Tile { /// `Wall` represents an impassible wall Wall, - /// `Air` represents empty walkable space - Air, + /// `Room` represents empty walkable space for a rectangular room + Room, + /// `Hallway` represents empty walkable space for a hallway + Hallway, /// `Stairs` represents stairs to another floor Stairs, } @@ -48,7 +50,7 @@ impl Tile { } impl Default for Tile { fn default() -> Self { - Self::Air + Self::Wall } } @@ -213,7 +215,8 @@ impl Floor { let tile = self.get(pos); let char = match tile { Tile::Wall => '#', - Tile::Air => '.', + Tile::Room => '.', + Tile::Hallway => ',', Tile::Stairs => '>', }; output.push(char); @@ -233,7 +236,7 @@ impl Floor { let Some(pos) = Pos::new(x, y) else { continue; }; - if self.get(pos) != Tile::Air { + if self.get(pos) == Tile::Wall { continue; } break pos; @@ -245,7 +248,7 @@ impl Default for Floor { /// Returns a floor with a single set of walls on the map border fn default() -> Self { let player_start = const_pos!(1, 1); - let mut tiles = Box::new([Tile::Air; TILE_COUNT]); + let mut tiles = Box::new([Tile::Room; TILE_COUNT]); let seed = 0u64; for pos in Pos::values() { |