diff options
| author | troido <troido@protonmail.com> | 2020-04-06 16:01:00 +0200 |
|---|---|---|
| committer | troido <troido@protonmail.com> | 2020-04-06 16:01:00 +0200 |
| commit | 66a3d3131f32e7bae2f0f7c4fd0b0c876eb3e8a0 (patch) | |
| tree | b6e7fe873be9c17b49596946543ee24f3771745d /src/componentwrapper.rs | |
| parent | e8d3e3c4f69fc5bab2b32b16b7c8c2c4a8a89a4b (diff) | |
shortcut or defining some entities like crops
Diffstat (limited to 'src/componentwrapper.rs')
| -rw-r--r-- | src/componentwrapper.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/componentwrapper.rs b/src/componentwrapper.rs index d00b592..4b9401a 100644 --- a/src/componentwrapper.rs +++ b/src/componentwrapper.rs @@ -189,18 +189,18 @@ components!( loot .iter() .map(|param| {match param { - Parameter::Template(template) => Some((template.clone(), 1.0)), + Parameter::Template(template) => Ok((template.clone(), 1.0)), Parameter::List(l) => { if l.len() == 2 { if let (Parameter::Template(template), Parameter::Float(chance)) = (l[0].clone(), l[1].clone()) { - return Some((template.clone(), chance)) + return Ok((template.clone(), chance)) } } - None? + Err(aerr!("loot list elements as list must only contain a template and a float: {:?}", l))? }, - _ => None? + _ => Err(aerr!("loot list elements must be a template or a list: {:?}", param))? }}) - .collect::<Option<Vec<(Template, f64)>>>().ok_or(aerr!("invalid loot definition"))? + .collect::<Result<Vec<(Template, f64)>>>()? } }; Grow ( |
