From: Ian Jackson Date: Tue, 30 Mar 2021 19:44:53 +0000 (+0100) Subject: hand generalisation: wip use Sort X-Git-Tag: otter-0.5.0~370 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=f059bce480c1b81e03f4221e41330cb8f3afa952;p=otter.git hand generalisation: wip use Sort Signed-off-by: Ian Jackson --- diff --git a/src/hand.rs b/src/hand.rs index 41ed2a34..6498a9b8 100644 --- a/src/hand.rs +++ b/src/hand.rs @@ -38,6 +38,12 @@ impl Sort { fn unclaimed_desc(self) -> HtmlLit { use Sort::*; Html::lit(match self { Hand => UNCLAIMED_HAND_DESC, }) } + fn deact_desc(self) -> HtmlLit { use Sort::*; Html::lit(match self { + Hand => "Deactivate hand", + }) } + fn claim_desc(self) -> HtmlLit { use Sort::*; Html::lit(match self { + Hand => "Claim this as your hand", + }) } } impl HandState { @@ -162,14 +168,14 @@ impl PieceTrait for Hand { kind: UoKind::Piece, def_key: 'C', opname: "deactivate".to_owned(), - desc: Html::lit("Deactivate hand").into(), + desc: self.sort.deact_desc().into(), wrc: WRC::Unpredictable, }} else { UoDescription { kind: UoKind::Piece, def_key: 'C', opname: "claim".to_owned(), - desc: Html::lit("Claim this as your hand").into(), + desc: self.sort.claim_desc().into(), wrc: WRC::Unpredictable, }} })