diff options
author | Ian C <ianc@noddybox.co.uk> | 2023-01-30 19:16:40 +0000 |
---|---|---|
committer | Ian C <ianc@noddybox.co.uk> | 2023-01-30 19:16:40 +0000 |
commit | 1d07a8fcc9a4cf20fd44ca5e26184d4022321818 (patch) | |
tree | 0037e38a251caebe2cc601c3050acd8aa80c4824 | |
parent | d31e36abfc85a07ce53a931b0cff6fa54d2d4f54 (diff) |
Added offset to drawn cards for thoughtful klondike
-rw-r--r-- | klondike.c | 24 |
1 files changed, 17 insertions, 7 deletions
@@ -190,6 +190,7 @@ int Klondike(int draw, int thoughtful) int pos_y = 0; int move_pos_x = -1; int move_pos_y = -1; + int offset_y = 0; Init(deck); Shuffle(deck); @@ -211,6 +212,11 @@ int Klondike(int draw, int thoughtful) AddToPile(&pile, deck[i++]); } + if (thoughtful) + { + offset_y = 1; + } + while(!quit && !won) { Card c = {0}; @@ -230,21 +236,22 @@ int Klondike(int draw, int thoughtful) { for(n = 0; n < column_down[f].no; n++) { - DrawCard(2 + n, 1 + f * 5, !thoughtful, column_down[f].card[n]); + DrawCard(2 + n, 1 + f * 5, !thoughtful, + column_down[f].card[n]); } for(n = 0; n < column_up[f].no; n++) { - DrawCard(2 + column_down[f].no + n, 1 + f * 5, + DrawCard(2 + column_down[f].no + n + offset_y, 1 + f * 5, FALSE, column_up[f].card[n]); } } if (move_pos_x != -1) { - mvaddch(2 + column_down[move_pos_x].no + move_pos_y, + mvaddch(2 + column_down[move_pos_x].no + move_pos_y + offset_y, move_pos_x * 5, '*'); - mvaddch(2 + column_down[move_pos_x].no + move_pos_y, + mvaddch(2 + column_down[move_pos_x].no + move_pos_y + offset_y, move_pos_x * 5 + 4, '*'); } @@ -255,8 +262,10 @@ int Klondike(int draw, int thoughtful) } else { - mvaddch(2 + column_down[pos_x].no + pos_y, pos_x * 5, '>'); - mvaddch(2 + column_down[pos_x].no + pos_y, pos_x * 5 + 4, '<'); + mvaddch(2 + column_down[pos_x].no + pos_y + offset_y, + pos_x * 5, '>'); + mvaddch(2 + column_down[pos_x].no + pos_y + offset_y, + pos_x * 5 + 4, '<'); } if (autofill) @@ -393,7 +402,8 @@ int Klondike(int draw, int thoughtful) if (column_up[move_pos_x].no && column_up[move_pos_x].card[move_pos_y].value == 13 && - column_up[pos_x].no == 0 && column_down[pos_x].no == 0) + column_up[pos_x].no == 0 && + column_down[pos_x].no == 0) { can_move = TRUE; } |