diff options
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, + } + } +} |