[gnome-games] aisleriot: change status message when dealing is impossible in Spider games



commit 3b7980f71b387dc853cf377d3783a745e06ff529
Author: Vincent Povirk <madewokherd gmail com>
Date:   Sun Jun 14 22:21:29 2009 -0500

    aisleriot: change status message when dealing is impossible in Spider games
    
    bug #407329

 aisleriot/rules/spider.scm |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/aisleriot/rules/spider.scm b/aisleriot/rules/spider.scm
index 5c4a369..1160e71 100644
--- a/aisleriot/rules/spider.scm
+++ b/aisleriot/rules/spider.scm
@@ -168,13 +168,20 @@
   (and (droppable? start-slot card-list end-slot)
        (complete-transaction start-slot card-list end-slot)))
 
+(define (must-undo-to-deal?)
+  (and (not allow-empty-slots)
+       (not (empty-slot? stock))
+       (< (count-cards tableau 0) (length tableau))))
+
 (define (button-clicked slot)
   (and (= stock slot)
        (not (empty-slot? stock))
        (if (and (not allow-empty-slots)
                 (any-slot-empty? tableau))
 	   (begin
-             (set-statusbar-message (_"Please fill in empty pile first."))
+	     (if (must-undo-to-deal?)
+	         (set-statusbar-message (_"Undo until there are enough cards to fill all tableau piles"))
+	         (set-statusbar-message (_"Please fill in empty pile first.")))
              #f)
 	   (begin
 	     (deal-new-cards tableau)
@@ -279,9 +286,7 @@
       (count-cards (cdr slots) (+ acc (length (get-cards (car slots)))))))
 
 (define (hint-few-tableau-cards)
-  (and (not allow-empty-slots)
-       (not (empty-slot? stock))
-       (< (count-cards tableau 0) (length tableau))
+  (and (must-undo-to-deal?)
        (list 0 (_"Undo until there are enough cards to fill all tableau piles"))))
 
 (define (get-hint)



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