* Counts the numbers of tiles matching a specific type in the area around * @param tile the center tile of the 'count area' * @param cmp the comparator/matcher (@see CMSAMatcher) * @return the number of matching tiles around */
| 155 | * @return the number of matching tiles around |
| 156 | */ |
| 157 | static int CountMapSquareAround(TileIndex tile, CMSAMatcher cmp) |
| 158 | { |
| 159 | int num = 0; |
| 160 | |
| 161 | for (int dx = -3; dx <= 3; dx++) { |
| 162 | for (int dy = -3; dy <= 3; dy++) { |
| 163 | TileIndex t = TileAddWrap(tile, dx, dy); |
| 164 | if (t != INVALID_TILE && cmp(t)) num++; |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | return num; |
| 169 | } |
| 170 | |
| 171 | /** |
| 172 | * Check whether the tile is a mine. |
no test coverage detected