diff options
| author | dawidg81 <dawidgorski.m@gmail.com> | 2026-02-10 10:21:07 +0100 |
|---|---|---|
| committer | dawidg81 <dawidgorski.m@gmail.com> | 2026-02-10 10:21:07 +0100 |
| commit | 276235b1bde16e5d240645c0f214d6cbce634be5 (patch) | |
| tree | bc8ff5a194e5de2c525871cdb580ff79ad98c088 /src/Game.cpp | |
| parent | b18c6a7de79e7a823ba4ab5f8077a1c44c242c22 (diff) | |
| parent | c4f70660d01d7d25a7f7a1e78d6e72097ca82e2e (diff) | |
Merge branch 'main' of ssh://100.95.135.112/srv/git/minesweeper
This merge is necessary to integrate all devices into one
synchronization
Diffstat (limited to 'src/Game.cpp')
| -rw-r--r-- | src/Game.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/Game.cpp b/src/Game.cpp index e81ccd3..c9c53dd 100644 --- a/src/Game.cpp +++ b/src/Game.cpp @@ -62,11 +62,17 @@ void Game::updateBoard() { for(int x=0; x < boardWidth; x++) { - if(flagMap[y][x] == true) + if (flagMap[y][x] == true) { tileMap[y][x] = 10; continue; } + else if (!flagMap[y][x] && !revealedMap[y][x]) + { + tileMap[y][x] = 0; + continue; + } + else if(!revealedMap[y][x]) continue; int bombs = bombCheck(x, y); @@ -134,10 +140,18 @@ void Game::displayBoard() system("clear"); #endif - std::cout << msg; + std::cout << msg << "\n "; + + for (int i = 0; i < boardHeight; i++) { + std::cout << i; + } + + std::cout << "\n\n"; for(int y=0; y < boardHeight; y++) { + std::cout << y << " "; + for(int x = 0; x < boardWidth; x++) { if(tileMap[y][x] == 0) putchar('#'); @@ -148,6 +162,7 @@ void Game::displayBoard() putchar('\n'); } + putchar('\n'); } int Game::bombCheck(int x, int y) @@ -267,6 +282,10 @@ void Game::input() if(revealedMap[y][x]) { msg = "You can't place flag on revealed tile.\n"; + } + + if(flagMap[y][x]){ + flagMap[y][x] = false; } else { flagMap[y][x] = true; } |
