[aisleriot] plait: Use hint-move instead of get-name.



commit fcfd0445e92af8b2793ed2bbdb6d408229e8dc5d
Author: Vincent Povirk <madewokherd gmail com>
Date:   Sat Nov 19 13:43:44 2011 -0600

    plait: Use hint-move instead of get-name.
    
    For bug 551859.

 games/plait.scm |   54 +++++++++++++++++++++++++-----------------------------
 games/sol.scm   |    6 +++++-
 2 files changed, 30 insertions(+), 30 deletions(-)
---
diff --git a/games/plait.scm b/games/plait.scm
index 1cc9ce3..c1f1670 100644
--- a/games/plait.scm
+++ b/games/plait.scm
@@ -88,10 +88,7 @@
   (and (not (null? home-list))
        (if (and (not (empty-slot? slot))
 		(move-possible? (get-top-card slot) (car home-list)))
-	   (if (not (empty-slot? (car home-list)))
-	       (list 1 (get-name (get-top-card slot))
-		     (get-name (get-top-card (car home-list))))
-	       (list 0 (format #f (_"Move ~a to an empty field") (get-name (get-top-card slot)))))
+           (hint-move slot 1 (car home-list))
 	   (get-valid-move slot (cdr home-list)))))
 
 (define (get-valid-moves slot-list home-list)
@@ -163,55 +160,55 @@
   (shuffle-deck)
 
   (get-and-increment-position-half)
-  (add-normal-slot '())
+  (add-normal-slot '() 'edge)
   (add-blank-slot)
-  (add-extended-slot '() down)
+  (add-extended-slot '() down 'plait)
   (add-blank-slot)
-  (add-normal-slot '())
+  (add-normal-slot '() 'edge)
   (get-and-increment-position-half)
   (add-blank-slot)
   (add-blank-slot)
-  (add-normal-slot '())
-  (add-normal-slot '())
+  (add-normal-slot '() 'foundation)
+  (add-normal-slot '() 'foundation)
   (add-carriage-return-slot)
 
-  (add-normal-slot '())
-  (add-normal-slot '())
+  (add-normal-slot '() 'tableau)
+  (add-normal-slot '() 'tableau)
   (add-blank-slot)
   (add-blank-slot)
-  (add-normal-slot '())
-  (add-normal-slot '())
+  (add-normal-slot '() 'tableau)
+  (add-normal-slot '() 'tableau)
   (set! VERTPOS (+ VERTPOS 0.5))
-  (add-normal-slot '())
-  (add-normal-slot DECK)
+  (add-normal-slot '() 'waste)
+  (add-normal-slot DECK 'stock)
   (set! VERTPOS (- VERTPOS 0.5))
-  (add-normal-slot '())
-  (add-normal-slot '())
+  (add-normal-slot '() 'foundation)
+  (add-normal-slot '() 'foundation)
   (add-carriage-return-slot)
 
-  (add-normal-slot '())
-  (add-normal-slot '())
+  (add-normal-slot '() 'tableau)
+  (add-normal-slot '() 'tableau)
   (add-blank-slot)
   (add-blank-slot)
-  (add-normal-slot '())
-  (add-normal-slot '())
+  (add-normal-slot '() 'tableau)
+  (add-normal-slot '() 'tableau)
   (add-blank-slot)
   (add-blank-slot)
-  (add-normal-slot '())
-  (add-normal-slot '())
+  (add-normal-slot '() 'foundation)
+  (add-normal-slot '() 'foundation)
   (add-carriage-return-slot)
 
   (get-and-increment-position-half)
-  (add-normal-slot '())
+  (add-normal-slot '() 'edge)
   (add-blank-slot)
   (add-blank-slot)
   (add-blank-slot)
-  (add-normal-slot '())
+  (add-normal-slot '() 'edge)
   (get-and-increment-position-half)
   (add-blank-slot)
   (add-blank-slot)
-  (add-normal-slot '())
-  (add-normal-slot '())
+  (add-normal-slot '() 'foundation)
+  (add-normal-slot '() 'foundation)
   (add-carriage-return-slot)
 
   (deal-cards-face-up deck '(0
@@ -354,8 +351,7 @@
 		       '(3 4 11 12 17 18 21 22))
       (deal-possible?)
       (if (find-valid-move stock '(0 2 5 6 7 8 13 14 15 16 19 20))
-	  (list 0 (format #f (_"Move ~a from the stock to an empty edge or tableau slot") 
-		  (get-name (get-top-card stock))))
+	  (hint-move stock 1 (find-valid-move stock '(0 2 5 6 7 8 13 14 15 16 19 20)))
 	  #f)))
 
 (define (game-cont)
diff --git a/games/sol.scm b/games/sol.scm
index 15fd542..6656a02 100644
--- a/games/sol.scm
+++ b/games/sol.scm
@@ -69,7 +69,8 @@
   (set-statusbar-message " ")
   (set! HISTORY '())
   (set! FOUNDATION-SLOTS '())
-  (set! TABLEAU-SLOTS '()))
+  (set! TABLEAU-SLOTS '())
+  (set! EDGE-SLOTS '()))
 
 ; Use this instead of define for variables which determine the state of
 ; the game. i.e. anything that isn't a constant. This is so undo/redo
@@ -444,6 +445,7 @@
   (if (empty-slot? to-slot)
       (cond ((member to-slot FOUNDATION-SLOTS) (if (= (length FOUNDATION-SLOTS) 1) (_"Move ~a onto the foundation.") (_"Move ~a onto an empty foundation slot.")))
             ((member to-slot TABLEAU-SLOTS) (if (= (length TABLEAU-SLOTS) 1) (_"Move ~a onto the tableau.") (_"Move ~a onto an empty tableau slot.")))
+            ((member to-slot EDGE-SLOTS) (_"Move ~a onto an empty edge slot."))
             (else (_"Move ~a onto an empty slot.")))
       (let* ((card (get-top-card to-slot)) (value (get-value card)) (suit (get-suit card)))
              (cond ((is-joker? card)
@@ -573,6 +575,7 @@
 (define (set-tag! slot)
   (case (cadddr slot)
     ((tableau) (set! TABLEAU-SLOTS (cons SLOTS TABLEAU-SLOTS)))
+    ((edge) (set! EDGE-SLOTS (cons SLOTS EDGE-SLOTS)))
     ((foundation) (set! FOUNDATION-SLOTS (cons SLOTS FOUNDATION-SLOTS))))
   (set! SLOTS (+ 1 SLOTS))
   (cons (- SLOTS 1) (cdr slot)))
@@ -612,6 +615,7 @@
 (define IN-GAME #f)
 (define FOUNDATION-SLOTS '())
 (define TABLEAU-SLOTS '())
+(define EDGE-SLOTS '())
 
 ; called from C:
 (define (start-game)



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