|
|
@ -172,6 +172,7 @@ impl Debug for Card { |
|
|
pub struct RunningPile { |
|
|
pub struct RunningPile { |
|
|
pub cards: Vec<Card>, |
|
|
pub cards: Vec<Card>, |
|
|
pub face_down: bool, |
|
|
pub face_down: bool, |
|
|
|
|
|
pub visible: bool, |
|
|
#[serde(flatten)] |
|
|
#[serde(flatten)] |
|
|
pub other: HashMap<String, serde_json::Value>, |
|
|
pub other: HashMap<String, serde_json::Value>, |
|
|
} |
|
|
} |
|
|
@ -183,6 +184,7 @@ impl RunningPile { |
|
|
cards: p.cards.into_iter().map(|kind| {let other = available_cards.get(&kind).unwrap().other.clone(); Card {kind, uuid: Uuid::new_v4(), other}}).collect(), |
|
|
cards: p.cards.into_iter().map(|kind| {let other = available_cards.get(&kind).unwrap().other.clone(); Card {kind, uuid: Uuid::new_v4(), other}}).collect(), |
|
|
other: p.other, |
|
|
other: p.other, |
|
|
face_down: p.face_down, |
|
|
face_down: p.face_down, |
|
|
|
|
|
visible: p.visible |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -195,6 +197,7 @@ impl RunningPile { |
|
|
rhai::serde::from_dynamic(map.get("cards").ok_or("Pile doesn't have property cards")?)?; |
|
|
rhai::serde::from_dynamic(map.get("cards").ok_or("Pile doesn't have property cards")?)?; |
|
|
|
|
|
|
|
|
let face_down: bool = rhai::serde::from_dynamic(map.get("face_down").ok_or("Pile doesn't have property face_down")?)?; |
|
|
let face_down: bool = rhai::serde::from_dynamic(map.get("face_down").ok_or("Pile doesn't have property face_down")?)?; |
|
|
|
|
|
let visible: bool = rhai::serde::from_dynamic(map.get("visible").ok_or("Pile doesn't have property visible")?)?; |
|
|
|
|
|
|
|
|
let other_fallible: Vec<Result<(String, serde_json::Value), Box<rhai::EvalAltResult>>> = |
|
|
let other_fallible: Vec<Result<(String, serde_json::Value), Box<rhai::EvalAltResult>>> = |
|
|
map.into_iter() |
|
|
map.into_iter() |
|
|
@ -210,6 +213,6 @@ impl RunningPile { |
|
|
other.insert(k, v); |
|
|
other.insert(k, v); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Ok(Self { cards, other, face_down }) |
|
|
Ok(Self { cards, other, face_down, visible }) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|