From: Ian Jackson Date: Mon, 15 Mar 2021 01:04:26 +0000 (+0000) Subject: hidden: Recalculate occultations every time on ungrab X-Git-Tag: otter-0.4.0~37 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=3faadc656c0808e4b8a26d47043094d4183b43f7;p=otter.git hidden: Recalculate occultations every time on ungrab Signed-off-by: Ian Jackson --- diff --git a/apitest/at-otter.rs b/apitest/at-otter.rs index d17e9fe5..459eee0a 100644 --- a/apitest/at-otter.rs +++ b/apitest/at-otter.rs @@ -532,7 +532,7 @@ impl Ctx { prepare_game(&self.su().ds, TABLE)?; let mut alice = self.connect_player(&self.alice)?; let mut bob = self.connect_player(&self.bob)?; - self.su_mut().mgmt_conn.fakerng_load(&[&"1"])?; + self.su_mut().mgmt_conn.fakerng_load(&[&"1",&"0"])?; let mut a_pieces = alice.pieces::()?; let mut b_pieces = alice.pieces::()?; diff --git a/daemon/api.rs b/daemon/api.rs index 361a95d5..8733ea2d 100644 --- a/daemon/api.rs +++ b/daemon/api.rs @@ -333,6 +333,13 @@ api_route!{ update, logents); + if let Some(occid) = gpc.occult.passive_occid() { + // xxx if piece is occulted, definitely repermute its occultation + // so that we don't leak which piece is which over repeated + // adjustment clicks + to_permute.mark_dirty(occid); + }; + let update= recalculate_occultation_piece( gs, @@ -342,9 +349,6 @@ api_route!{ piece, vanilla, ).map_err(|e| OnlineError::from(e))?; - // xxx if piece is occulted, definitely repermute its occultation - // so that we don't leak which piece is which over repeated - // adjustment clicks update } diff --git a/src/hidden.rs b/src/hidden.rs index 035b5bca..0ba31ef9 100644 --- a/src/hidden.rs +++ b/src/hidden.rs @@ -65,6 +65,7 @@ pub type OccultationKind = OccultationKindGeneral<(Area, ZCoord)>; impl PieceOccult { pub fn is_active(&self) -> bool { self.active.is_some() } + pub fn passive_occid(&self) -> Option { Some(self.passive?.occid) } } impl Default for OccultationKind {