diff options
| author | Freya Murphy <freya@freyacat.org> | 2025-10-07 11:42:05 -0400 |
|---|---|---|
| committer | Freya Murphy <freya@freyacat.org> | 2025-10-08 19:37:16 -0400 |
| commit | d16fe269aec12c88d22054d87cdef84e2b55b100 (patch) | |
| tree | b7ef2134245e63208671c2cac36e1d902401b19a /dungeon/src/map.rs | |
| parent | initial baseline (diff) | |
| download | DungeonCrawl-d16fe269aec12c88d22054d87cdef84e2b55b100.tar.gz DungeonCrawl-d16fe269aec12c88d22054d87cdef84e2b55b100.tar.bz2 DungeonCrawl-d16fe269aec12c88d22054d87cdef84e2b55b100.zip | |
impl default to dungeon and its types
Diffstat (limited to 'dungeon/src/map.rs')
| -rw-r--r-- | dungeon/src/map.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/dungeon/src/map.rs b/dungeon/src/map.rs index 8c4328c..b6f3356 100644 --- a/dungeon/src/map.rs +++ b/dungeon/src/map.rs @@ -187,3 +187,23 @@ impl Floor { &mut *self.tiles } } +impl Default for Floor { + /// Returns a floor with a single set of walls on the map border + fn default() -> Self { + let mut tiles = Box::new([Tile::Air; TILE_COUNT]); + let player_start = Pos::new_const::<1, 1>(); + let seed = 0u64; + + for pos in Pos::values() { + if pos.is_border() { + tiles[pos.idx()] = Tile::Wall; + } + } + + Self { + tiles, + player_start, + seed, + } + } +} |