From: Ian Jackson Date: Thu, 14 Apr 2022 20:01:09 +0000 (+0100) Subject: Make PieceBaseTrait dyn_upcast-able X-Git-Tag: otter-1.1.0~582 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=e7e34ea53ec8acaf5083a975e7f15a4255cc1d7f;p=otter.git Make PieceBaseTrait dyn_upcast-able Signed-off-by: Ian Jackson --- diff --git a/src/clock.rs b/src/clock.rs index 9bc52e7f..228c3c77 100644 --- a/src/clock.rs +++ b/src/clock.rs @@ -432,6 +432,7 @@ impl OutlineTrait for Clock { } } +#[dyn_upcast] impl PieceBaseTrait for Clock { fn nfaces(&self) -> RawFaceId { 1 } diff --git a/src/deck.rs b/src/deck.rs index f653a11c..d466eee3 100644 --- a/src/deck.rs +++ b/src/deck.rs @@ -96,6 +96,7 @@ impl Deck { } } +#[dyn_upcast] impl PieceBaseTrait for Deck { fn nfaces(&self) -> RawFaceId { 1 } diff --git a/src/gamestate.rs b/src/gamestate.rs index 50f4ac18..03947302 100644 --- a/src/gamestate.rs +++ b/src/gamestate.rs @@ -173,6 +173,7 @@ pub struct UoDescription { pub wrc: WhatResponseToClientOp, } +#[dyn_upcast] pub trait PieceBaseTrait: OutlineTrait + Send + Debug + 'static { /// By convention, occult face is nfaces-1 fn nfaces(&self) -> RawFaceId; diff --git a/src/hand.rs b/src/hand.rs index 6430c2a7..42994149 100644 --- a/src/hand.rs +++ b/src/hand.rs @@ -146,6 +146,7 @@ impl Behaviour { } } +#[dyn_upcast] impl PieceBaseTrait for Hand { fn nfaces(&self) -> RawFaceId { 1 } diff --git a/src/pieces.rs b/src/pieces.rs index ab38f3c5..33263627 100644 --- a/src/pieces.rs +++ b/src/pieces.rs @@ -126,6 +126,7 @@ impl OutlineTrait for GenericSimpleShape } // let edge_attrs = format!(r##"stroke-width="" stroke"## +#[dyn_upcast] impl PieceBaseTrait for SimpleShape { fn nfaces(&self) -> RawFaceId { self.count_faces() } diff --git a/src/shapelib.rs b/src/shapelib.rs index 7a85c1f4..b38ee293 100644 --- a/src/shapelib.rs +++ b/src/shapelib.rs @@ -224,6 +224,7 @@ impl OutlineTrait for ItemInertForOcculted { delegate! { to self.outline { fn thresh_dragraise(&self) -> Result, IE>; fn bbox_approx(&self) -> Result; }}} +#[dyn_upcast] impl PieceBaseTrait for ItemInertForOcculted { fn nfaces(&self) -> RawFaceId { 1 } fn itemname(&self) -> &str { &self.itemname.as_str() } @@ -369,6 +370,7 @@ impl Item { } } +#[dyn_upcast] impl PieceBaseTrait for Item { fn nfaces(&self) -> RawFaceId { (self.faces.len()