summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--klondike.c2
-rw-r--r--pile.c8
-rw-r--r--pile.h1
3 files changed, 10 insertions, 1 deletions
diff --git a/klondike.c b/klondike.c
index b71be07..153cb03 100644
--- a/klondike.c
+++ b/klondike.c
@@ -279,7 +279,7 @@ int Klondike(int draw, int thoughtful)
}
else
{
- SwapPile(&pile, &turned);
+ MovePile(&turned, &pile);
}
break;
diff --git a/pile.c b/pile.c
index 793cc7c..fa9ba46 100644
--- a/pile.c
+++ b/pile.c
@@ -132,6 +132,14 @@ void SwapPile(Pile *a, Pile *b)
*b = t;
}
+void MovePile(Pile *from, Pile *to)
+{
+ while(from->no)
+ {
+ MoveTopCard(from, to);
+ }
+}
+
void FreePile(Pile *p)
{
if (p->card)
diff --git a/pile.h b/pile.h
index c3cfc16..d63b32e 100644
--- a/pile.h
+++ b/pile.h
@@ -41,6 +41,7 @@ Card PopPile(Pile *pile);
Card TopOfPile(Pile *pile);
void MoveTopCard(Pile *from, Pile *to);
void SwapPile(Pile *a, Pile *b);
+void MovePile(Pile *from, Pile *to);
void FreePile(Pile *p);
#endif