📄 expandmines(uint row, uint col).txt
字号:
//in file : MineWnd.cpp
//雷方块拓展(对于周围无雷的空白区域)
void CMineWnd::ExpandMines(UINT row, UINT col)
{
UINT i,j;
UINT minRow = (row == 0) ? 0 : row - 1;
UINT maxRow = row +2;
UINT minCol = (col == 0) ? 0 : col - 1;
UINT maxCol = col + 2;
UINT around = GetAroundNum(row ,col);
//显示该区域的方块状态
m_pMines[row][col].uState = 15 - around;
m_pMines[row][col].uOldState = 15 - around;
//“打开”该区域,重绘
DrawSpecialMine (row,col);
//对周围一个雷都没有的空白区域
if (around == 0)
{
for (i = minRow; i < maxRow; i++)
{
for (j = minCol; j < maxCol; j++)
{
//对于周围可以拓展的区域进行的拓展
if (!(i == row && j == col) &&
m_pMines[i][j].uState == STATE_NORMAL
&& m_pMines[i][j].uAttrib != ATTRIB_MINE)
{
if (! IsInMineArea(i,j)) continue;
ExpandMines(i, j); // 递归拓展操作
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -