[aisleriot] Revert "Remove the get-value-name and get-suit-name functions."



commit a32f0e1a36f72880e84cfcae2d1e253b121ff499
Author: Vincent Povirk <madewokherd gmail com>
Date:   Wed Sep 28 04:21:53 2011 -0500

    Revert "Remove the get-value-name and get-suit-name functions."
    
    This reverts commit 7da9f554f6fa929f959bb7b0d5a56f349f95b699.
    
    Again, sorry.

 games/Rules.HOWTO  |    3 +++
 games/doublets.scm |   18 +-----------------
 games/sol.scm      |   23 +++++++++++++++++++++++
 src/game.c         |   17 +++++++++++------
 4 files changed, 38 insertions(+), 23 deletions(-)
---
diff --git a/games/Rules.HOWTO b/games/Rules.HOWTO
index ece4335..8634877 100644
--- a/games/Rules.HOWTO
+++ b/games/Rules.HOWTO
@@ -359,6 +359,9 @@ Quite a few are self explanatory:
 (check-alternating-color-list card-list)
 (check-straight-descending-list card-list) 
 (length card-list)
+(get-value-name value)    ; card value to string
+(get-suit-name suit)      ; card suit to string
+(get-joker-name card)     ; name of a particular joker 
 (get-name card)           ; card description as a string
 (set-cards! slot-id card-list) ; puts card-list into the slot "slot-id"
 (make-card value suit)   ; turn a value and a suit into a card
diff --git a/games/doublets.scm b/games/doublets.scm
index 8b35888..17b1dbd 100644
--- a/games/doublets.scm
+++ b/games/doublets.scm
@@ -151,26 +151,10 @@
 (define (game-won)
   (= 48 (length (get-cards 8))))
 
-(define (get-value-hint value)
-  (cond ((eq? value ace) (_"You are searching for an ace."))
-        ((eq? value 2) (_"You are searching for a two."))
-        ((eq? value 3) (_"You are searching for a three."))
-        ((eq? value 4) (_"You are searching for a four."))
-        ((eq? value 5) (_"You are searching for a five."))
-        ((eq? value 6) (_"You are searching for a six."))
-        ((eq? value 7) (_"You are searching for a seven."))
-        ((eq? value 8) (_"You are searching for an eight."))
-        ((eq? value 9) (_"You are searching for a nine."))
-        ((eq? value 10) (_"You are searching for a ten."))
-        ((eq? value jack) (_"You are searching for a jack."))
-        ((eq? value queen) (_"You are searching for a queen."))
-        ((eq? value king) (_"You are searching for a king."))
-        (#t (_"Unknown value"))))
-
 (define (get-hint)
   (let ((wanted (modulo (* 2 (get-value (get-top-card 8))) 
 			13)))
-    (list 0 (get-value-hint wanted))))
+    (list 4 (get-value-name wanted))))
 
 (define (get-options) #f)
 
diff --git a/games/sol.scm b/games/sol.scm
index 3ae6fd9..3cadd98 100644
--- a/games/sol.scm
+++ b/games/sol.scm
@@ -367,6 +367,29 @@
   (map display objs) (newline))
 
 ; hint procedures
+(define (get-value-name value)
+  (cond ((eq? value ace) (_"ace"))
+        ((eq? value 2) (_"two"))
+        ((eq? value 3) (_"three"))
+        ((eq? value 4) (_"four"))
+        ((eq? value 5) (_"five"))
+        ((eq? value 6) (_"six"))
+        ((eq? value 7) (_"seven"))
+        ((eq? value 8) (_"eight"))
+        ((eq? value 9) (_"nine"))
+        ((eq? value 10) (_"ten"))
+        ((eq? value jack) (_"jack"))
+        ((eq? value queen) (_"queen"))
+        ((eq? value king) (_"king"))
+        (#t (_"Unknown value"))))
+
+(define (get-suit-name suit)
+  (cond ((eq? suit club) (_"clubs"))
+        ((eq? suit spade) (_"spades"))
+        ((eq? suit heart) (_"hearts"))
+        ((eq? suit diamond) (_"diamonds"))
+        (#t (_"Unknown suit"))))
+
 (define (get-joker-name card) 
   (if (is-black? card) (_"black joker") (_"red joker")))
 
diff --git a/src/game.c b/src/game.c
index 0b5ba0c..b730d69 100644
--- a/src/game.c
+++ b/src/game.c
@@ -2186,12 +2186,17 @@ aisleriot_game_get_hint (AisleriotGame *game)
                  aisleriot_game_get_game_file (game));
       break;
 
-    case 4: /* This is deprecated (due to i18n issues) do not use. */
-      g_warning ("This game uses a deprecated hint method (case 4).\n"
-                 "Please file a bug at http://bugzilla.gnome.org "
-                 "including this message and the name of the game "
-                 "you were playing, which is %s.\n",
-                 aisleriot_game_get_game_file (game));
+    case 4:
+      string1 = SCM_CADR (hint);
+      if (!scm_is_string (string1))
+        break;
+
+      str1 = scm_to_locale_string (string1);
+      scm_dynwind_free (str1);
+      if (!str1)
+        break;
+
+      message = g_strdup_printf (_("You are searching for a %s."), str1);
       break;
 
     default:



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