diff board.c @ 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 a9a7ad180c3b
children 4f6bf50dbc4a
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