[gnome-chess] Improve en passant description in history combo



commit 809df32ff157cc1b11df572b0a5616cedc895cc9
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Sun Dec 6 11:32:37 2020 -0600

    Improve en passant description in history combo
    
    Let's show the actual positions of the pieces.
    
    Note I couldn't figure out how to use markup here. Enabling it in the
    GtkCellRenderer didn't seem to work.

 src/gnome-chess.vala | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)
---
diff --git a/src/gnome-chess.vala b/src/gnome-chess.vala
index a2cd017..f8cbc11 100644
--- a/src/gnome-chess.vala
+++ b/src/gnome-chess.vala
@@ -1068,14 +1068,7 @@ Copyright © 2015–2016 Sahil Sareen""";
         switch (scene.move_format)
         {
         case "human":
-            if (move.en_passant)
-            {
-                if (move.r0 < move.r1)
-                    move_text = _("White pawn captures black pawn en passant");
-                else
-                    move_text = _("Black pawn captures white pawn en passant");
-            }
-            else if (move.castling_rook != null)
+            if (move.castling_rook != null)
             {
                 if (move.f0 < move.f1 && move.r0 == 0)
                     move_text = _("White castles kingside");
@@ -1101,7 +1094,19 @@ Copyright © 2015–2016 Sahil Sareen""";
 
                 var start = "%c%d".printf ('a' + move.f0, move.r0 + 1);
                 var end = "%c%d".printf ('a' + move.f1, move.r1 + 1);
-                move_text = _(human_descriptions[index]).printf (start, end);
+                var template = _(human_descriptions[index]);
+                if (move.en_passant)
+                {
+                    if (move.r0 < move.r1)
+                    {   /* Human Move String: Description of a white pawn at %1$s capturing a pawn at %2$s 
en passant */
+                        template = _("White pawn at %1$s takes the black pawn at %2$s en passant");
+                    }
+                    else
+                    {   /* Human Move String: Description of a black pawn at %1$s capturing a pawn at %2$s 
en passant */
+                        template = _("Black pawn at %1$s takes white pawn at %2$s en passant");
+                    }
+                }
+                move_text = template.printf (start, end);
             }
             break;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]