Smarter stack erasing.
This commit is contained in:
parent
18a78c9713
commit
f4e9a10572
@ -55,11 +55,19 @@ static char *card_value(enum value value) {
|
|||||||
return(card_value);
|
return(card_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void erase_card(struct card *card) {
|
||||||
|
werase(card->frame->window);
|
||||||
|
wbkgd(card->frame->window, WHITE_ON_GREEN);
|
||||||
|
wrefresh(card->frame->window);
|
||||||
|
}
|
||||||
|
|
||||||
void erase_stack(struct stack *stack) {
|
void erase_stack(struct stack *stack) {
|
||||||
|
if (maneuvre_stack(stack)) {
|
||||||
for (; stack; stack = stack->next) {
|
for (; stack; stack = stack->next) {
|
||||||
werase(stack->card->frame->window);
|
erase_card(stack->card);
|
||||||
wbkgd(stack->card->frame->window, WHITE_ON_GREEN);
|
}
|
||||||
wrefresh(stack->card->frame->window);
|
} else {
|
||||||
|
erase_card(stack->card);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,13 +119,8 @@ void draw_card(struct card *card) {
|
|||||||
void draw_stack(struct stack *stack) {
|
void draw_stack(struct stack *stack) {
|
||||||
erase_stack(stack);
|
erase_stack(stack);
|
||||||
if (empty(stack)) {
|
if (empty(stack)) {
|
||||||
WINDOW *empty_stack = newwin(FRAME_HEIGHT,
|
box(stack->card->frame->window, 0, 0);
|
||||||
FRAME_WIDTH,
|
wrefresh(stack->card->frame->window);
|
||||||
stack->card->frame->begin_y,
|
|
||||||
stack->card->frame->begin_x);
|
|
||||||
box(empty_stack, 0, 0);
|
|
||||||
wrefresh(empty_stack);
|
|
||||||
delwin(empty_stack);
|
|
||||||
} else {
|
} else {
|
||||||
if (maneuvre_stack(stack)) {
|
if (maneuvre_stack(stack)) {
|
||||||
struct stack *reversed_stack = reverse(stack);
|
struct stack *reversed_stack = reverse(stack);
|
||||||
|
Loading…
Reference in New Issue
Block a user