Skip to content

Commit

Permalink
Merge pull request thecardkid#22 from thecardkid/hn/disallow-repeat-s…
Browse files Browse the repository at this point in the history
…pawns

FIX: repeated block spawning is now disallowed
  • Loading branch information
Shane Kelly authored Apr 6, 2017
2 parents 6fd773f + cd18b77 commit 510bcee
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/block_factory.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@ void spawn(State* s) {
s->block->x = SPAWN_X;
s->block->y = 1;

int n;

if (spawn_space_available(s)) {
s->next = rand() % NUM_BLOCKS;
while ((n = rand() % NUM_BLOCKS) == s->next) {
n = rand() % NUM_BLOCKS;
}
s->next = n;
} else {
s->mode = SHUTDOWN;
}
Expand Down

0 comments on commit 510bcee

Please sign in to comment.