| 278 | } |
| 279 | |
| 280 | staticfn boolean |
| 281 | find_guard_dest(struct monst *guard, coordxy *rx, coordxy *ry) |
| 282 | { |
| 283 | coordxy x, y, dd, lx, ly; |
| 284 | |
| 285 | for (dd = 2; (dd < ROWNO || dd < COLNO); dd++) { |
| 286 | for (y = u.uy - dd; y <= u.uy + dd; y++) { |
| 287 | if (y < 0 || y > ROWNO - 1) |
| 288 | continue; |
| 289 | for (x = u.ux - dd; x <= u.ux + dd; x++) { |
| 290 | if (y != u.uy - dd && y != u.uy + dd && x != u.ux - dd) |
| 291 | x = u.ux + dd; |
| 292 | if (x < 1 || x > COLNO - 1) |
| 293 | continue; |
| 294 | if (guard && ((x == guard->mx && y == guard->my) |
| 295 | || (guard->isgd && in_fcorridor(guard, x, y)))) |
| 296 | continue; |
| 297 | if (levl[x][y].typ == CORR) { |
| 298 | lx = (x < u.ux) ? x + 1 : (x > u.ux) ? x - 1 : x; |
| 299 | ly = (y < u.uy) ? y + 1 : (y > u.uy) ? y - 1 : y; |
| 300 | if (levl[lx][ly].typ != STONE && levl[lx][ly].typ != CORR) |
| 301 | goto incr_radius; |
| 302 | *rx = x; |
| 303 | *ry = y; |
| 304 | return TRUE; |
| 305 | } |
| 306 | } |
| 307 | } |
| 308 | incr_radius: |
| 309 | ; |
| 310 | } |
| 311 | impossible("Not a single corridor on this level?"); |
| 312 | tele(); |
| 313 | return FALSE; |
| 314 | } |
| 315 | |
| 316 | void |
| 317 | invault(void) |
no test coverage detected