From: Ian Jackson Date: Sun, 28 Feb 2021 15:32:52 +0000 (+0000) Subject: Introduce OccultedPieceTrait as a thing that a piece can do X-Git-Tag: otter-0.4.0~203 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=3577c4fb1515895054f00b02365845ef206f5852;p=otter.git Introduce OccultedPieceTrait as a thing that a piece can do Nothing impls or calls this yet. Signed-off-by: Ian Jackson --- diff --git a/src/gamestate.rs b/src/gamestate.rs index 33294c1d..8851bead 100644 --- a/src/gamestate.rs +++ b/src/gamestate.rs @@ -155,6 +155,8 @@ pub trait PieceTrait: OutlineTrait + Send + Debug + 'static { fn describe_html(&self, gpc: &GPiece) -> Result; + fn occultable(&self) -> Option<&dyn OccultedPieceTrait> { None } + fn delete_hook(&self, _p: &GPiece, _gs: &mut GameState) -> ExecuteGameChangeUpdates { ExecuteGameChangeUpdates{ pcs: vec![], log: vec![], raw: None } @@ -163,6 +165,11 @@ pub trait PieceTrait: OutlineTrait + Send + Debug + 'static { fn itemname(&self) -> &str; } +pub trait OccultedPieceTrait: OutlineTrait + 'static { + fn svg(&self, f: &mut Html, id: VisiblePieceId) -> Result<(),IE>; + fn describe_html(&self) -> Result; +} + #[derive(Debug)] pub struct ApiPieceOpArgs<'a> { pub gs: &'a mut GameState,