From 430640c009cdcf02137f8168acd64fb42ab2ee48 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 24 Mar 2021 18:24:40 +0000 Subject: [PATCH] deck: Refactor, ready for counting instead, fix current_face Signed-off-by: Ian Jackson --- src/deck.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/deck.rs b/src/deck.rs index e0b171c0..8ac3370a 100644 --- a/src/deck.rs +++ b/src/deck.rs @@ -68,8 +68,11 @@ impl Deck { if gpc.occult.is_active() { Enabled } else { Disabled } } - fn current_face(&self, gpc: &GPiece) -> FaceId { - (gpc.occult.is_active() as RawFaceId).into() + fn current_face(&self, gpc: &GPiece, goccults: &GameOccults) -> FaceId { + RawFaceId::from(match self.state(gpc, goccults) { + Disabled => 0, + Enabled => 1, + }).into() } } @@ -79,7 +82,7 @@ impl PieceTrait for Deck { #[throws(IE)] fn svg_piece(&self, f: &mut Html, gpc: &GPiece, gs: &GameState, _vpid: VisiblePieceId) { - let face = self.current_face(gpc); + let face = self.current_face(gpc, &gs.occults); self.shape.svg_piece_raw(f, face, &mut |_|Ok::<_,IE>(()))?; if_chain! { if let Some(label) = &self.label; -- 2.30.2