2021-12-01 10:47:41 -05:00
|
|
|
mod common;
|
|
|
|
mod simple_map;
|
|
|
|
|
2021-12-01 11:02:39 -05:00
|
|
|
use crate::{Map, Position};
|
2021-12-01 10:47:41 -05:00
|
|
|
use common::*;
|
|
|
|
use simple_map::SimpleMapBuilder;
|
2021-12-01 11:41:29 -05:00
|
|
|
use specs::prelude::*;
|
2021-12-01 10:47:41 -05:00
|
|
|
|
2021-12-01 11:41:29 -05:00
|
|
|
pub trait MapBuilder {
|
2021-12-01 12:03:49 -05:00
|
|
|
fn build_map(&mut self);
|
|
|
|
fn spawn_entities(&mut self, ecs: &mut World);
|
|
|
|
fn get_map(&self) -> Map;
|
|
|
|
fn get_starting_position(&self) -> Position;
|
2021-12-01 14:45:27 -05:00
|
|
|
fn get_snapshot_history(&self) -> Vec<Map>;
|
|
|
|
fn take_snapshot(&mut self);
|
2021-12-01 10:47:41 -05:00
|
|
|
}
|
|
|
|
|
2021-12-01 12:03:49 -05:00
|
|
|
pub fn random_builder(new_depth: i32) -> Box<dyn MapBuilder> {
|
2021-12-01 11:41:29 -05:00
|
|
|
// Note that until we have a second map type, this isn't even slightly random
|
2021-12-01 12:03:49 -05:00
|
|
|
Box::new(SimpleMapBuilder::new(new_depth))
|
2021-12-01 10:47:41 -05:00
|
|
|
}
|