chiark / gitweb /
dice: Change SpecialClientRendering representation
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 16 Apr 2022 10:12:25 +0000 (11:12 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 16 Apr 2022 11:50:11 +0000 (12:50 +0100)
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 <ijackson@chiark.greenend.org.uk>
src/dice.rs
src/pcrender.rs

index 4dfb0f20961e64a16573e32519d9de9332af4420..429bdc85740df73f56ddd5e606f5da37a726fc88 100644 (file)
@@ -310,7 +310,7 @@ impl PieceBaseTrait for Die {
 
   #[throws(IE)]
   fn special(&self) -> Option<SpecialClientRendering> {
-    Some(SpecialClientRendering::DieCooldown)
+    Some(SpecialClientRendering::Die{})
   }
 }
 
index bdffa164d57a20145cf4b3efd6f93320ab38a509..f41aa71d7a2fe0872fe8d83e671db1411532a4e0 100644 (file)
@@ -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)]