From f6170b9caab1ab0f0c119161a4c61aaaf0720d13 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 15 Mar 2021 16:22:37 +0000 Subject: [PATCH] hidden: Add ShowUnocculted to ui_operations Signed-off-by: Ian Jackson --- src/bin/otterlib.rs | 3 ++- src/gamestate.rs | 2 +- src/hand.rs | 2 +- src/pcrender.rs | 8 ++++---- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/bin/otterlib.rs b/src/bin/otterlib.rs index ec14edca..ccbd406e 100644 --- a/src/bin/otterlib.rs +++ b/src/bin/otterlib.rs @@ -95,7 +95,8 @@ fn preview(items: Vec) { let loaded = spec.clone().load().context("load")?; let p = loaded.p; // xxx show occulted version too let mut uos = vec![]; - p.add_ui_operations(&mut uos, &GPiece::dummy()).context("add uos")?; + p.add_ui_operations(&mut uos, &GPiece::dummy(), unocc_ok) + .context("add uos")?; let uos = uos.into_iter().map(|uo| uo.opname).collect::>(); let spec = spec.clone(); diff --git a/src/gamestate.rs b/src/gamestate.rs index 1e233fe0..853d7532 100644 --- a/src/gamestate.rs +++ b/src/gamestate.rs @@ -134,7 +134,7 @@ pub trait PieceTrait: OutlineTrait + Send + Debug + 'static { #[throws(InternalError)] fn add_ui_operations(&self, _upd: &mut Vec, - _gpc: &GPiece) { } + _gpc: &GPiece, _y: ShowUnocculted) { } fn ui_operation(&self, _a: ApiPieceOpArgs<'_>, _opname: &str, _wrc: WhatResponseToClientOp) diff --git a/src/hand.rs b/src/hand.rs index 7776e2ff..5a51e7c7 100644 --- a/src/hand.rs +++ b/src/hand.rs @@ -116,7 +116,7 @@ impl PieceTrait for Hand { #[throws(InternalError)] fn add_ui_operations(&self, upd: &mut Vec, - gpc: &GPiece) { + gpc: &GPiece, _: ShowUnocculted) { upd.push(if_chain! { if let Some(xdata) = gpc.xdata.get::()?; if let Some(_owner) = &xdata.owner; diff --git a/src/pcrender.rs b/src/pcrender.rs index 34c92375..24491e5c 100644 --- a/src/pcrender.rs +++ b/src/pcrender.rs @@ -189,10 +189,10 @@ impl PieceRenderInstructions { #[throws(InternalError)] pub fn ui_operations(&self, gpc: &GPiece, p: &dyn PieceTrait) - -> Vec + -> Vec { - match self.occulted { - PriOcculted::Visible(_) => (), + let y = match self.occulted { + PriOcculted::Visible(y) => y, PriOcculted::Occulted | PriOcculted::Displaced(..) => return vec![], }; @@ -208,7 +208,7 @@ impl PieceRenderInstructions { desc: Html::lit("flip"), }) } - p.add_ui_operations(&mut out, gpc)?; + p.add_ui_operations(&mut out, gpc, y)?; out } } -- 2.30.2