Merge remote-tracking branch 'DolphyWind/tty-solitaire/auto_uncover_top'
This commit is contained in:
commit
17cfae9c54
11
src/game.c
11
src/game.c
@ -141,7 +141,16 @@ void move_block(struct stack **origin, struct stack **destination,
|
||||
if (stack_length(*destination) > 1) {
|
||||
cursor->y += block_size;
|
||||
}
|
||||
stack_free(tmp);
|
||||
}
|
||||
|
||||
void expose_top(struct stack **origin)
|
||||
{
|
||||
struct card *top;
|
||||
if((top = stack_pop(origin)))
|
||||
{
|
||||
card_expose(top);
|
||||
stack_push(origin, top);
|
||||
}
|
||||
}
|
||||
|
||||
static void fill_deck(struct deck *deck) {
|
||||
|
@ -43,6 +43,7 @@ bool stock_stack(struct stack *);
|
||||
bool valid_move(struct stack *, struct stack *);
|
||||
void move_card(struct stack **, struct stack **);
|
||||
void move_block(struct stack **, struct stack **, int);
|
||||
void expose_top(struct stack **);
|
||||
void game_init(struct game *, int, int);
|
||||
bool game_won();
|
||||
void game_end();
|
||||
|
@ -158,6 +158,7 @@ static void handle_card_movement(struct cursor *cursor) {
|
||||
;
|
||||
if (valid_move(block, *destination)) {
|
||||
move_block(origin, destination, _marked_cards_count);
|
||||
expose_top(origin);
|
||||
}
|
||||
} else {
|
||||
if (valid_move(*origin, *destination)) {
|
||||
@ -165,6 +166,7 @@ static void handle_card_movement(struct cursor *cursor) {
|
||||
cursor->y++;
|
||||
}
|
||||
move_card(origin, destination);
|
||||
expose_top(origin);
|
||||
}
|
||||
}
|
||||
draw_stack(*origin);
|
||||
|
Loading…
Reference in New Issue
Block a user