From c6a425785ae0b6ef22a4881bc139dd1b36c7d1c5 Mon Sep 17 00:00:00 2001 From: dawidg81 Date: Sun, 8 Feb 2026 11:53:17 +0100 Subject: Fixing flag feature --- src/Game.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Game.cpp b/src/Game.cpp index ad8eed0..f5d71e1 100644 --- a/src/Game.cpp +++ b/src/Game.cpp @@ -51,7 +51,7 @@ void Game::updateBoard(){ for(int y=0; y < boardHeight; y++){ for(int x=0; x < boardWidth; x++){ if(!revealed[y][x]) continue; - // if(!flag[y][x]) continue; + if(flag[y][x]) continue; else tileMap[y][x] = 10; int bombs = bombCheck(x, y); @@ -118,7 +118,7 @@ void Game::displayBoard() { for(int x = 0; x < boardWidth; x++){ if(tileMap[y][x] == 0) putchar('#'); else if(tileMap[y][x] == 1) putchar('.'); - // else if(tileMap[y][x] == 10) putchar('F'); + else if(tileMap[y][x] == 10) putchar('F'); else putchar('0' + tileMap[y][x] - 1); } putchar('\n'); @@ -186,7 +186,11 @@ void Game::input(){ } } - //if(cmd == "f"){ - // flag[y][x] = true; - //} + if(cmd == "f"){ + if(revealed[y][x]){ + std::cout << "You can't place flag here.\n"; + } else { + flag[y][x] = true; + } + } } -- cgit v1.2.3