16035
|
1 |
use landgen::maze::MazeTemplate;
|
|
2 |
use serde_derive::Deserialize;
|
|
3 |
|
|
4 |
use std::collections::hash_map::HashMap;
|
|
5 |
#[derive(Deserialize)]
|
|
6 |
pub struct TemplateDesc {
|
16073
|
7 |
width: u32,
|
|
8 |
height: u32,
|
16035
|
9 |
max_hedgehogs: u8,
|
16073
|
10 |
cell_size: u32,
|
16035
|
11 |
distortion_limiting_factor: u32,
|
|
12 |
braidness: u32,
|
|
13 |
invert: bool,
|
|
14 |
}
|
|
15 |
|
|
16 |
#[derive(Deserialize)]
|
|
17 |
pub struct TemplateCollectionDesc {
|
|
18 |
pub templates: Vec<TemplateDesc>,
|
|
19 |
pub template_types: HashMap<String, Vec<usize>>,
|
|
20 |
}
|
|
21 |
|
|
22 |
impl From<&TemplateDesc> for MazeTemplate {
|
|
23 |
fn from(desc: &TemplateDesc) -> Self {
|
|
24 |
MazeTemplate {
|
|
25 |
width: desc.width,
|
|
26 |
height: desc.height,
|
|
27 |
cell_size: desc.cell_size,
|
|
28 |
inverted: desc.invert,
|
|
29 |
distortion_limiting_factor: desc.distortion_limiting_factor,
|
|
30 |
braidness: desc.braidness,
|
|
31 |
}
|
|
32 |
}
|
|
33 |
}
|