refactor code to be smaller and clearer

This commit is contained in:
KyoZM 2019-10-10 20:52:52 -03:00
parent 6b42b1c762
commit 83a4454be5

View File

@ -96,8 +96,9 @@ impl Asset for StructuresSpec {
}
}
fn convert(specifications: &StructuresSpec) -> Vec<Arc<Structure>> {
return specifications
fn load_structures(specifier: &str) -> Vec<Arc<Structure>> {
let spec = assets::load::<StructuresSpec>(&["world.manifests.", specifier].concat());
return spec.unwrap()
.0
.iter()
.map(|sp| {
@ -109,12 +110,6 @@ fn convert(specifications: &StructuresSpec) -> Vec<Arc<Structure>> {
.collect();
}
fn load_structures(specifier: &str) -> Vec<Arc<Structure>> {
dbg!(specifier);
let spec = assets::load::<StructuresSpec>(&["world.manifests.", specifier].concat());
return convert(&spec.unwrap());
}
lazy_static! {
pub static ref OAKS: Vec<Arc<Structure>> = load_structures("oaks");