From: Ian Jackson Date: Sat, 16 Apr 2022 10:12:25 +0000 (+0100) Subject: dice: Change SpecialClientRendering representation X-Git-Tag: otter-1.1.0~536 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=65a77c28a50c9d1799593437e701a17704e3ea1f;p=otter.git dice: Change SpecialClientRendering representation Making this an internally-tageed union is going to be nicer for the JS, which then doesn't have to prat about with Object.keys(thing)[0] etc. And the special rendering is Die, not DieCooldown, since if dice get a second kind of special rendering thta will have to be here too. Signed-off-by: Ian Jackson --- diff --git a/src/dice.rs b/src/dice.rs index 4dfb0f20..429bdc85 100644 --- a/src/dice.rs +++ b/src/dice.rs @@ -310,7 +310,7 @@ impl PieceBaseTrait for Die { #[throws(IE)] fn special(&self) -> Option { - Some(SpecialClientRendering::DieCooldown) + Some(SpecialClientRendering::Die{}) } } diff --git a/src/pcrender.rs b/src/pcrender.rs index bdffa164..f41aa71d 100644 --- a/src/pcrender.rs +++ b/src/pcrender.rs @@ -14,8 +14,9 @@ pub struct VisibleAngleTransform(Html); const DEFKEY_FLIP: UoKey = 'f'; #[derive(Serialize,Debug)] +#[serde(tag="kind")] pub enum SpecialClientRendering { - DieCooldown + Die { }, } #[derive(Debug,Clone)]