From 9fb31fbc501865d61a12649183bce1520740058e Mon Sep 17 00:00:00 2001 From: Daniel Jones Date: Sat, 25 Apr 2020 21:50:02 +0930 Subject: dont allow revealing flagged tile --- ncsweeper.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ncsweeper.c b/ncsweeper.c index 9ba9d60..6355e76 100644 --- a/ncsweeper.c +++ b/ncsweeper.c @@ -251,6 +251,7 @@ main(void) { draw(); ch = getch(); /* blocking */ + struct tile *tile = gettileat(cursor.x, cursor.y); switch(ch) { case 'k': @@ -277,7 +278,6 @@ main(void) break; case 'f': { - struct tile *tile = gettileat(cursor.x, cursor.y); if (tile && tile->state & HIDDEN) { tile->state ^= FLAGGED; @@ -286,7 +286,8 @@ main(void) break; } case ' ': - exitgame = reveal(cursor.x, cursor.y); + if (tile && !(tile->state & FLAGGED)) + exitgame = reveal(cursor.x, cursor.y); break; case 'q': -- cgit v1.2.3