chiark / gitweb /
hand generalisation: wip use Sort
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 30 Mar 2021 19:44:53 +0000 (20:44 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 30 Mar 2021 19:44:53 +0000 (20:44 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/hand.rs

index 41ed2a34458b4e1ad4644684b2ccc11b4a553cd4..6498a9b8dc10d6697d4b38a460fce9e36069d34e 100644 (file)
@@ -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,
       }}
     })