summaryrefslogtreecommitdiff
path: root/dungeon/src/map.rs
diff options
context:
space:
mode:
Diffstat (limited to 'dungeon/src/map.rs')
-rw-r--r--dungeon/src/map.rs36
1 files changed, 2 insertions, 34 deletions
diff --git a/dungeon/src/map.rs b/dungeon/src/map.rs
index ade485e..fef0750 100644
--- a/dungeon/src/map.rs
+++ b/dungeon/src/map.rs
@@ -212,41 +212,8 @@ impl Floor {
*hash
}
- /// Display the floor as a string for debugging
- ///
- /// # Examples
- /// ```no_run
- /// use dungeon::Floor;
- /// let floor = Floor::generate();
- /// println!("{}", floor.display());
- /// ```
- #[must_use]
- pub fn display(&self) -> String {
- let mut output = String::new();
- for pos in Pos::values() {
- // If it's the player start, show 'P'
- if self.player_start == pos {
- output.push('P');
- continue;
- }
- // Otherwise, show the tile character
- let tile = self.get(pos);
- let char = match tile {
- Tile::Wall => '#',
- Tile::Room => '.',
- Tile::Hallway => ',',
- Tile::Stairs => '>',
- };
- output.push(char);
- // Newline at the end of each row
- if pos.xy().0 == MAP_SIZE - 1 {
- output.push('\n');
- }
- }
- output
- }
-
/// Returns a random open (no wall) position
+ #[must_use]
pub fn random_pos(&mut self) -> Pos {
loop {
let pos = self.rand().random();
@@ -258,6 +225,7 @@ impl Floor {
}
/// Returns the random number gen for the `Floor`
+ #[must_use]
pub fn rand(&mut self) -> &mut impl Rng {
&mut self.rng
}