chiark / gitweb /
Provide load_inert for SimplePieceSpec
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 15 Apr 2022 17:38:00 +0000 (18:38 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 15 Apr 2022 17:39:13 +0000 (18:39 +0100)
This will let us use these as backgrounds for dice.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/pieces.rs

index 37297dc8a21fc510310cba6a5cd637ad160d9d9e..ab38f3c53b82d1b1e7ce48da1a78f9c1a261622a 100644 (file)
@@ -365,6 +365,15 @@ macro_rules! impl_PieceSpec_for_SimplePieceSpec { { $ty:ty } => {
         occultable: None,
       }
     }
+
+    #[throws(SpecError)]
+    fn load_inert(&self, _ig: &Instance, _:SpecDepth)
+                  -> SpecLoaded<dyn InertPieceTrait> {
+      SpecLoaded {
+        p: Box::new(self.load_raw()?.0) as _,
+        occultable: None
+      }
+    }
   }
 } }