From: Ian Jackson Date: Sun, 21 Feb 2021 00:50:43 +0000 (+0000) Subject: Make Hand be rectangles only X-Git-Tag: otter-0.4.0~410 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=5e3671e42d05cb291bc845b61642a8201cbf98da;p=otter.git Make Hand be rectangles only Signed-off-by: Ian Jackson --- diff --git a/src/hand.rs b/src/hand.rs index 77384f8a..da4038f4 100644 --- a/src/hand.rs +++ b/src/hand.rs @@ -16,7 +16,7 @@ struct MagicOwner { #[derive(Debug,Serialize,Deserialize)] struct Hand { - shape: GenericSimpleShape<(), OutlineRepr>, + shape: GenericSimpleShape<(), shapelib::Rectangle>, } #[derive(Debug,Clone,Default,Serialize,Deserialize)] @@ -49,9 +49,13 @@ impl PieceSpec for piece_specs::Hand { edges: self.edge.iter().cloned().collect(), edge_width: self.edge_width, }; + let shape = match self.shape { + OutlineRepr::Rectangle(r) => r, + _ => throw!(SpecError::UnsupportedShape), + }; let shape = GenericSimpleShape::new( (), - self.shape.clone(), + shape, "magic-hand", &common)?; Box::new(Hand { diff --git a/src/spec.rs b/src/spec.rs index 59933764..c8d0e8eb 100644 --- a/src/spec.rs +++ b/src/spec.rs @@ -82,8 +82,7 @@ pub enum SpecError { ZeroFaces, InconsistentFacesEdgecoloursCount, SpecifiedWidthOfNoEdges, - ItemnameSpecifiedWhereForbidden, - MultifacetedMagic, + UnsupportedShape, } display_as_debug!{SpecError}