src/Controller/controllerOperation.cpp
/**
 * Click a block and four blocks around it if no mine there.
 * @param x
 * @param y
 */
Click a block and four blocks around it if no mine there.
@param x
@param y
Click a block and four blocks around it if no mine there . @param x @param y
void Controller::Controller::recursionClick(uint16_t x, uint16_t y) {
    if (!isOut(x, y) && (*getShowedField()->GetMap())[x][y] == MapGenerator::BLOCKTYPE::UNREVEALED) {
        --getShowedField()->GetMines();
        (*getShowedField()->GetMap())[x][y] = (*getMineField()->GetMap())[x][y];
        if ((*getMineField()->GetMap())[x][y] == 0) {
            for (int i = -1; i <= 1; ++i) {
                for (int j = -1; j <= 1; ++j) {
                    if (!(i == 0 && j == 0)) {
                        recursionClick(x + i, y + j);
                    }
                }
            }
        }
    }
}
void Controller :: Controller :: recursionClick ( uint16_t x , uint16_t y ) { if ( ! isOut ( x , y ) && ( * getShowedField ( ) -> GetMap ( ) ) [ x ] [ y ] == MapGenerator :: BLOCKTYPE :: UNREVEALED ) { -- getShowedField ( ) -> GetMines ( ) ; ( * getShowedField ( ) -> GetMap ( ) ) [ x ] [ y ] = ( * getMineField ( ) -> GetMap ( ) ) [ x ] [ y ] ; if ( ( * getMineField ( ) -> GetMap ( ) ) [ x ] [ y ] == 0 ) { for ( int i = -1 ; i <= 1 ; ++ i ) { for ( int j = -1 ; j <= 1 ; ++ j ) { if ( ! ( i == 0 && j == 0 ) ) { recursionClick ( x + i , y + j ) ; } } } } } }
Click a block and four blocks around it if no mine there.
Click a block and four blocks around it if no mine there .