From a0aacfde67882c6e77cdbc2da139ec004145ba25 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 30 Apr 2022 02:21:13 +0100 Subject: [PATCH] PieceTrait: impl Downcast We're going to want this in a moment. Signed-off-by: Ian Jackson --- src/gamestate.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gamestate.rs b/src/gamestate.rs index 8596e500..242aa00b 100644 --- a/src/gamestate.rs +++ b/src/gamestate.rs @@ -197,7 +197,7 @@ pub trait PieceBaseTrait: OutlineTrait + Send + Debug + 'static { #[ambassador::delegatable_trait] #[typetag::serde] // usual variable: p -pub trait PieceTrait: PieceBaseTrait + Send + Debug + 'static { +pub trait PieceTrait: PieceBaseTrait + Downcast + Send + Debug + 'static { fn add_ui_operations(&self, _y: ShowUnocculted, _upd: &mut Vec, _gs: &GameState, _gpc: &GPiece) -> Result<(),IE> { @@ -287,6 +287,7 @@ pub trait PieceTrait: PieceBaseTrait + Send + Debug + 'static { .into_inner().unwrap() }) } } +impl_downcast!(PieceTrait); #[typetag::serde] pub trait InertPieceTrait: PieceBaseTrait { -- 2.30.2