chiark / gitweb /
PieceTrait: impl Downcast
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 30 Apr 2022 01:21:13 +0000 (02:21 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 30 Apr 2022 14:15:30 +0000 (15:15 +0100)
We're going to want this in a moment.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/gamestate.rs

index 8596e50096dfe365b2e2340ecc8b53271b1520c0..242aa00b84916b0527e793108a5e25d966228c15 100644 (file)
@@ -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<UoDescription>,
                        _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 {