fix backwards compatible rule fields
This commit is contained in:
parent
07cbd88618
commit
5af7cc0cb1
2 changed files with 6 additions and 3 deletions
|
@ -27,7 +27,9 @@ pub struct Rule {
|
|||
variants: Vec<SubRule>,
|
||||
pub enabled: bool,
|
||||
// probability: u8
|
||||
#[serde(alias = "flip_h")]
|
||||
pub flip_x: bool,
|
||||
#[serde(alias = "flip_v")]
|
||||
pub flip_y: bool,
|
||||
pub rotate: bool,
|
||||
}
|
||||
|
|
|
@ -82,9 +82,10 @@ impl UScope {
|
|||
{
|
||||
let s = fs::read_to_string(path).ok()?;
|
||||
let data: Value = serde_json::from_str(&s).ok()?;
|
||||
let cell_types = serde_json::from_value(data["cell_types"].clone()).ok()?;
|
||||
let groups = serde_json::from_value(data["groups"].clone()).ok()?;
|
||||
let rules = serde_json::from_value(data["rules"].clone()).ok()?;
|
||||
// TODO: show errors to user
|
||||
let cell_types = serde_json::from_value(data["cell_types"].clone()).unwrap();
|
||||
let groups = serde_json::from_value(data["groups"].clone()).unwrap();
|
||||
let rules = serde_json::from_value(data["rules"].clone()).unwrap();
|
||||
self.cell_types = cell_types;
|
||||
self.dish.rules = rules;
|
||||
self.dish.cell_groups = groups;
|
||||
|
|
Loading…
Reference in a new issue