summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2019-10-27 00:23:38 -0400
committerAndrew Opalach <andrew@akon.city> 2019-10-27 00:23:38 -0400
commitada53c1b0d303e420d884e77845a31c9de6dfa12 (patch)
treea893e0b3ea833752fbff825eb0e661df10a173cb /lib
parent06701c4619678f8f34ce9c66c20c73645c85912e (diff)
downloadcetris-ada53c1b0d303e420d884e77845a31c9de6dfa12.tar.gz
cetris-ada53c1b0d303e420d884e77845a31c9de6dfa12.tar.bz2
cetris-ada53c1b0d303e420d884e77845a31c9de6dfa12.zip
misc fixes
Diffstat (limited to 'lib')
-rw-r--r--lib/cetris.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/cetris.h b/lib/cetris.h
index e5a7a7e..57f2a17 100644
--- a/lib/cetris.h
+++ b/lib/cetris.h
@@ -534,6 +534,7 @@ void update_board(cetris_game *g) {
add_score(g, lines_cleared);
if (lines_cleared > 0) {
g->lines += lines_cleared;
+ if (g->lines >= 20) g->game_over = true;
if (g->lines >= (g->level * 10))
g->level++;
}
@@ -606,7 +607,7 @@ CETRIS_EXPORT void move_piece(cetris_game *g, uint8_t move) {
}
-CETRIS_EXPORT void init_game(cetris_game *g) {
+CETRIS_EXPORT void init_game(cetris_game *g, cetris_config* c) {
/* check for config errors */
assert(CETRIS_NEXT_PIECE_DELAY >= CETRIS_LINE_CLEAR_DELAY);
@@ -618,6 +619,7 @@ CETRIS_EXPORT void init_game(cetris_game *g) {
#endif
memset(g, 0, sizeof(cetris_game));
+ memcpy(&g->config, c, sizeof(cetris_config));
g->level = CETRIS_STARTING_LEVEL;
g->highest_line = CETRIS_BOARD_Y;