summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Jones <admin@danieljon.es>2020-04-25 21:50:02 +0930
committerDaniel Jones <admin@danieljon.es>2020-04-25 21:50:02 +0930
commit9fb31fbc501865d61a12649183bce1520740058e (patch)
tree85b6978a70f518e37123c1b254c3452bba39040a
parent9ef2c081393f398b1d5f531e82b1522d39e169a7 (diff)
downloadcsweeper-9fb31fbc501865d61a12649183bce1520740058e.tar.gz
csweeper-9fb31fbc501865d61a12649183bce1520740058e.zip
dont allow revealing flagged tile
-rw-r--r--ncsweeper.c5
1 files 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':