Erasing stacks when empty. Also moved some event-related code to the keyboard object.

This commit is contained in:
Murilo Soares Pereira
2010-04-21 04:14:39 -03:00
parent 87909b5075
commit 7b39ec5cc6
11 changed files with 50 additions and 16 deletions

View File

@@ -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;