summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2018-12-21 09:04:26 +0000
committerIan C <ianc@noddybox.co.uk>2018-12-21 09:04:26 +0000
commit3e4827768ddfe27fbacc1f0f1cec3bd8c891e001 (patch)
tree658ee33299b65467c2fe17df12174e0977152307
parentf9ea797ebea7c3675db61153532f793cdfb81471 (diff)
Added option to show cards on quit.
-rw-r--r--README2
-rw-r--r--csol.c32
2 files changed, 32 insertions, 2 deletions
diff --git a/README b/README
index e3c6877..992f5e3 100644
--- a/README
+++ b/README
@@ -26,6 +26,6 @@ On starting a game of Klondike, the following applies
* Press '1', '2', '3' or '4' to move the top card from the hearts,
diamonds, spades or clubs suit pile respectively back onto the board.
- * Press 'Q' to quit.
+ * Press 'Q' to quit. You'll be asked if you want to see the cards.
The '?' key can be used to get help at anytime.
diff --git a/csol.c b/csol.c
index e16c979..d305c13 100644
--- a/csol.c
+++ b/csol.c
@@ -492,7 +492,7 @@ static void KlondikeHelp(void)
"Press '1', '2', '3' or '4' to move the top card from the hearts, ",
"diamonds, spades or clubs suit pile respectively back onto the board.",
"",
- "Press 'Q' to quit.",
+ "Press 'Q' to quit. You'll be asked if you want to see the cards.",
"",
"",
"Press SPACE to continue.",
@@ -530,6 +530,7 @@ static void Klondike(int draw)
int i;
int won = FALSE;
int quit = FALSE;
+ int show = FALSE;
int pos_x = 0;
int pos_y = 0;
int move_pos_x = -1;
@@ -674,8 +675,16 @@ static void Klondike(int draw)
case 'Q':
case 'q':
+ {
+ int k;
+
quit = TRUE;
+ Centre(LINES-1, "Show cards?");
+ refresh();
+ k = getch();
+ show = (k == 'y' || k == 'Y');
break;
+ }
case 10:
if (move_pos_x == -1)
@@ -808,6 +817,27 @@ static void Klondike(int draw)
}
}
+ if (show)
+ {
+ for(f = 0; f < 7; f++)
+ {
+ for(n = 0; n < column_down[f].no; n++)
+ {
+ DrawCard(2 + n, 1 + f * 5, FALSE, column_down[f].card[n]);
+ }
+
+ for(n = 0; n < column_up[f].no; n++)
+ {
+ DrawCard(2 + column_down[f].no + n, 1 + f * 5,
+ FALSE, column_up[f].card[n]);
+ }
+ }
+
+ Centre(LINES - 1, "Press any key");
+ refresh();
+ getch();
+ }
+
if (won)
{
WinScreen();