[aisleriot] diamond-mine: Do not shadow functions in api.scm
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [aisleriot] diamond-mine: Do not shadow functions in api.scm
- Date: Sun, 13 Oct 2019 16:22:18 +0000 (UTC)
commit 79b14e88598e6e3046adb97c3b08a001ec21c7cc
Author: Otto Wallenius <owalleni gmail com>
Date: Sun Oct 13 18:20:08 2019 +0200
diamond-mine: Do not shadow functions in api.scm
Shadowing function find-card might cause other
games to crash when played after Diamond Mine
(bug 551859).
Unrelated to that, one variable is renamed
(size -> slot) for clarity and one redundant
expression in a conditional statement is removed.
games/diamond-mine.scm | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
---
diff --git a/games/diamond-mine.scm b/games/diamond-mine.scm
index 92a1e485..bfe0f2a8 100644
--- a/games/diamond-mine.scm
+++ b/games/diamond-mine.scm
@@ -275,24 +275,23 @@
(search-a-slot card-suit card-rank (cdr card-list)))
(#t #f)))
-(define (find-card card-suit card-rank slot)
+(define (visible-on-tableau? card-suit card-rank slot)
(cond ((= slot 14)
#f)
((and (not (empty-slot? slot))
(search-a-slot card-suit card-rank (get-cards slot)))
#t)
- (#t (find-card card-suit card-rank (+ 1 slot)))))
+ (#t (visible-on-tableau? card-suit card-rank (+ 1 slot)))))
-(define (check-a-tab-slot card-list size)
+(define (check-a-tab-slot card-list slot)
(cond ((or (< (length card-list) 2)
(not (is-visible? (cadr card-list))))
#f)
- ((and (is-visible? (cadr card-list))
- (not (= (get-suit (car card-list))
+ ((and (not (= (get-suit (car card-list))
(get-suit (cadr card-list))))
- (find-card (get-suit (car card-list)) (+ 1 (get-value (car card-list))) 1))
- size)
- (#t (check-a-tab-slot (cdr card-list) (+ size 1)))))
+ (visible-on-tableau? (get-suit (car card-list)) (+ 1 (get-value (car card-list))) 1))
+ slot)
+ (#t (check-a-tab-slot (cdr card-list) (+ slot 1)))))
(define (check-tableau-suit-changes slot)
(cond ((or (= slot 14)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]