Remove walls totally surrounded by stone */
| 195 | |
| 196 | /* Remove walls totally surrounded by stone */ |
| 197 | staticfn void |
| 198 | wall_cleanup(coordxy x1, coordxy y1, coordxy x2, coordxy y2) |
| 199 | { |
| 200 | uchar type; |
| 201 | coordxy x, y; |
| 202 | struct rm *lev; |
| 203 | |
| 204 | /* sanity check on incoming variables */ |
| 205 | if (x1 < 0 || x2 >= COLNO || x1 > x2 || y1 < 0 || y2 >= ROWNO || y1 > y2) |
| 206 | panic("wall_cleanup: bad bounds (%d,%d) to (%d,%d)", x1, y1, x2, y2); |
| 207 | |
| 208 | /* change walls surrounded by rock to rock. */ |
| 209 | for (x = x1; x <= x2; x++) |
| 210 | for (y = y1; y <= y2; y++) { |
| 211 | if (within_bounded_area(x, y, |
| 212 | gb.bughack.inarea.x1, gb.bughack.inarea.y1, |
| 213 | gb.bughack.inarea.x2, gb.bughack.inarea.y2)) |
| 214 | continue; |
| 215 | lev = &levl[x][y]; |
| 216 | type = lev->typ; |
| 217 | if (IS_WALL(type) && type != DBWALL) { |
| 218 | if (is_solid(x - 1, y - 1) && is_solid(x - 1, y) |
| 219 | && is_solid(x - 1, y + 1) && is_solid(x, y - 1) |
| 220 | && is_solid(x, y + 1) && is_solid(x + 1, y - 1) |
| 221 | && is_solid(x + 1, y) && is_solid(x + 1, y + 1)) |
| 222 | lev->typ = STONE; |
| 223 | } |
| 224 | } |
| 225 | } |
| 226 | |
| 227 | /* Correct wall types so they extend and connect to each other */ |
| 228 | void |
no test coverage detected