summaryrefslogtreecommitdiff
path: root/dungeon/src/map.rs
diff options
context:
space:
mode:
authoralf9310 <alf9310@rit.edu>2025-11-09 17:37:23 -0500
committeralf9310 <alf9310@rit.edu>2025-11-09 17:37:23 -0500
commit096ff7a891c350da000f18f01ffb4a1f9cde0899 (patch)
tree50132ffbfb2f5572ce4e52c0c06cc4abbb3508c8 /dungeon/src/map.rs
parentdungeon_generation: added stair generation and fixed room center vs rabdom po... (diff)
downloadDungeonCrawl-096ff7a891c350da000f18f01ffb4a1f9cde0899.tar.gz
DungeonCrawl-096ff7a891c350da000f18f01ffb4a1f9cde0899.tar.bz2
DungeonCrawl-096ff7a891c350da000f18f01ffb4a1f9cde0899.zip
dungeon_generation: added Hallway vs Room tiles
Diffstat (limited to 'dungeon/src/map.rs')
-rw-r--r--dungeon/src/map.rs15
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() {