changeset 4:aec74ae4d6e5 version-2

Fix the logic checking whether a generated board is playable
author Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
date Fri, 24 Oct 2014 17:12:12 +0200
parents 868670fcc17b
children ada3bc46169e
files board.c
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/board.c	Fri Oct 24 17:00:42 2014 +0200
+++ b/board.c	Fri Oct 24 17:12:12 2014 +0200
@@ -110,14 +110,14 @@
 			    (short)(rantaiwarna_rand(&board->seed) %
 			    board->colors) + 1;
 		}
-		if (board_check_status(board) & GAME_OVER) {
-			return (ERR);
+		if (!(board_check_status(board) & GAME_OVER)) {
+			break;
 		}
 	}
 
 	board->score = 0;
 
-	return (OK);
+	return (!(board->status & GAME_OVER) ? OK : ERR);
 }
 
 int