From f059bce480c1b81e03f4221e41330cb8f3afa952 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 30 Mar 2021 20:44:53 +0100 Subject: [PATCH] hand generalisation: wip use Sort Signed-off-by: Ian Jackson --- src/hand.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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, }} }) -- 2.30.2