diff options
| author | Freya Murphy <freya@freyacat.org> | 2025-11-18 10:24:03 -0500 |
|---|---|---|
| committer | Freya Murphy <freya@freyacat.org> | 2025-11-18 10:24:03 -0500 |
| commit | ff315c10418ced36de7996bd9a521f8b96c90631 (patch) | |
| tree | 75a50d8c46cae6096e9b6693d62c3d21f82587ad /dungeon/src/map.rs | |
| parent | dungeon: split rng into game/level to make maps consistant (diff) | |
| download | DungeonCrawl-ff315c10418ced36de7996bd9a521f8b96c90631.tar.gz DungeonCrawl-ff315c10418ced36de7996bd9a521f8b96c90631.tar.bz2 DungeonCrawl-ff315c10418ced36de7996bd9a521f8b96c90631.zip | |
dungeon: port rands SmallRng to be reproducible
Diffstat (limited to 'dungeon/src/map.rs')
| -rw-r--r-- | dungeon/src/map.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/dungeon/src/map.rs b/dungeon/src/map.rs index 4928a29..0d05b73 100644 --- a/dungeon/src/map.rs +++ b/dungeon/src/map.rs @@ -1,7 +1,7 @@ //! The `map` module contains structures of the dungeon game map //! including the current `Floor`, and map `Tile`. -use rand::{Rng, rngs::SmallRng}; +use rand::Rng; use strum::IntoEnumIterator; use strum_macros::EnumIter; @@ -11,7 +11,7 @@ use std::{ hash::{DefaultHasher, Hash, Hasher}, }; -use crate::pos::Pos; +use crate::{pos::Pos, rng::DungeonRng}; /// `MAP_SIZE` is the size of the size of the dungeon grid. pub const MAP_SIZE: u16 = 48; @@ -155,7 +155,7 @@ impl Floor { /// Returns a random open (no wall) position #[must_use] - pub fn random_walkable_pos(&self, rng: &mut SmallRng) -> Pos { + pub fn random_walkable_pos(&self, rng: &mut DungeonRng) -> Pos { loop { let pos = rng.random(); if !self.get(pos).is_walkable() { |