Erasing stacks when empty. Also moved some event-related code to the keyboard object.
This commit is contained in:
@@ -1,6 +1,22 @@
|
||||
#include <stdio.h>
|
||||
#include "display.h"
|
||||
#include "keyboard.h"
|
||||
|
||||
void handle_stock_event() {
|
||||
if (!empty(deck->stock)) {
|
||||
/* erase the stack before emptying it */
|
||||
if (length(deck->stock) == 1) {
|
||||
erase_stack(deck->stock);
|
||||
}
|
||||
move_card(&(deck->stock), &(deck->waste_pile));
|
||||
expose_card(deck->waste_pile->card);
|
||||
draw_stack(deck->stock);
|
||||
draw_stack(deck->waste_pile);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int key_event() {
|
||||
int pressed_key;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user