Randomly choose which map builder to use
This commit is contained in:
parent
86d46b8d5b
commit
0f8d4d8fab
@ -1,7 +1,9 @@
|
||||
mod bsp_dungeon;
|
||||
mod common;
|
||||
mod simple_map;
|
||||
|
||||
use crate::{Map, Position};
|
||||
use bsp_dungeon::BspDungeonBuilder;
|
||||
use common::*;
|
||||
use simple_map::SimpleMapBuilder;
|
||||
use specs::prelude::*;
|
||||
@ -16,6 +18,9 @@ pub trait MapBuilder {
|
||||
}
|
||||
|
||||
pub fn random_builder(new_depth: i32) -> Box<dyn MapBuilder> {
|
||||
// Note that until we have a second map type, this isn't even slightly random
|
||||
Box::new(SimpleMapBuilder::new(new_depth))
|
||||
let mut rng = rltk::RandomNumberGenerator::new();
|
||||
match rng.roll_dice(1, 2) {
|
||||
1 => Box::new(BspDungeonBuilder::new(new_depth)),
|
||||
_ => Box::new(SimpleMapBuilder::new(new_depth)),
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user