chiark / gitweb /
Introduce OccultedPieceTrait as a thing that a piece can do
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 28 Feb 2021 15:32:52 +0000 (15:32 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 10 Mar 2021 21:55:16 +0000 (21:55 +0000)
Nothing impls or calls this yet.

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

index 33294c1d1b0f8334c60109c575d24c3bc1f23aa6..8851bead7ece820e89e7302efce107fe426ae606 100644 (file)
@@ -155,6 +155,8 @@ pub trait PieceTrait: OutlineTrait + Send + Debug + 'static {
 
   fn describe_html(&self, gpc: &GPiece) -> Result<Html,IE>;
 
+  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<Html,IE>;
+}
+
 #[derive(Debug)]
 pub struct ApiPieceOpArgs<'a> {
   pub gs: &'a mut GameState,