From 5e3671e42d05cb291bc845b61642a8201cbf98da Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 21 Feb 2021 00:50:43 +0000 Subject: [PATCH] Make Hand be rectangles only Signed-off-by: Ian Jackson --- src/hand.rs | 8 ++++++-- src/spec.rs | 3 +-- 2 files changed, 7 insertions(+), 4 deletions(-) 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} -- 2.30.2