summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Game.cpp35
-rw-r--r--src/Game.hpp1
2 files changed, 36 insertions, 0 deletions
diff --git a/src/Game.cpp b/src/Game.cpp
index a703913..82c5eb7 100644
--- a/src/Game.cpp
+++ b/src/Game.cpp
@@ -147,6 +147,41 @@ void Game::displayBoard() {
}
}
+void Game::bombCheck(){
+ for(int x=0; x < boardWidth; x++){
+ for(int y=0; y < boardHeight; y++){
+ if(tileMap[x][y] == 1){
+ int bombsAround[boardWidth][boardHeight];
+
+ if(bombMap[x-1][y-1] == true){
+ bombsAround[x][y]++;
+ }
+ if(bombMap[x][y-1] == true){
+ bombsAround[x][y]++;
+ }
+ if(bombMap[x+1][y-1] == true){
+ bombsAround[x][y]++;
+ }
+ if(bombMap[x-1][y] == true){
+ bombsAround[x][y]++;
+ }
+ if(bombMap[x+1][y] == true){
+ bombsAround[x][y]++;
+ }
+ if(bombMap[x-1][y+1] == true){
+ bombsAround[x][y]++;
+ }
+ if(bombMap[x][y+1] == true){
+ bombsAround[x][y]++;
+ }
+ if(bombMap[x+1][y+1] == true){
+ bombsAround[x][y]++;
+ }
+ }
+ }
+ }
+}
+
void Game::input(){
std::string input;
diff --git a/src/Game.hpp b/src/Game.hpp
index 61a788e..e828780 100644
--- a/src/Game.hpp
+++ b/src/Game.hpp
@@ -20,6 +20,7 @@ public:
void initDiff(int diff);
void initBoard();
void displayBoard();
+ void bombCheck();
void input();
};