From: Ian Jackson Date: Mon, 22 Mar 2021 03:10:20 +0000 (+0000) Subject: deck: Insist that it must be a rectangle X-Git-Tag: otter-0.5.0~508 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=bd05f35eaea5e07860d5ea36f0d6bf441e426f5d;p=otter.git deck: Insist that it must be a rectangle We need this for the occultation region Signed-off-by: Ian Jackson --- diff --git a/src/deck.rs b/src/deck.rs index 3e965e39..868062e1 100644 --- a/src/deck.rs +++ b/src/deck.rs @@ -11,7 +11,7 @@ pub const DISABLED_DESC: &str = "a pickup deck (disabled)"; #[derive(Debug,Serialize,Deserialize)] struct Deck { - shape: GenericSimpleShape<(), Outline>, + shape: GenericSimpleShape<(), shapelib::Rectangle>, } #[dyn_upcast] @@ -36,9 +36,13 @@ impl PieceSpec for piece_specs::Deck { edges: self.edges.clone(), edge_width: self.edge_width, }; + let shape = match self.shape { + Outline::Rectangle(r) => r, + _ => throw!(SpecError::UnsupportedShape), + }; let shape = GenericSimpleShape::new( (), - self.shape.clone(), + shape.clone(), "magic-pickupdeck", &common)?; if shape.count_faces() != 2 {